Consider setting the GPIO pin as a pull up or pull down resistor.
For example:GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP)
That sets it as a pull up resistor meaning of it is exposed to ground it will trigger the button being pressed.
You can read it with:if GPIO.input(13) == False:
Print "desired print text"
↧
Answer by Meph88 for Python GPIO not reading inputs
↧