I want to use the GPIO-KEY button in my small project, the button is connected to pin 18. The button is not responding, I am using the RPi_GPIO library in Python. The program looks like this:
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18,GPIO.IN)
while True:
if GPIO.input(18) == 1:
print("YES")
else:
print("NO")
What am I doing wrong ?