I wounder what i'm doing wrong. I'm trying to get a button press to work with a small simple script. I've followed RPiMag issue 5, and want to read if GPIO 0 (pin 3) is connected to ground (pin 6) or not.
The following code is not working:
If i change to GPIO.setmode(GPIO.BOARD) and GPIO.setup(3, GPIO.IN) and change the if statement to check for input on 3 it works.
Code: Select all
from time import sleep import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(0, GPIO.IN) while True: if (GPIO.input(0) == 0): print("Button!") sleep(0.5);
Any idea how to get it working with GPIO.BCM mode? What am i doing wrong?
Best regards /Jon