Quantcast
Channel: Python GPIO not reading inputs - Raspberry Pi Stack Exchange
Viewing all articles
Browse latest Browse all 2

Answer by Meph88 for Python GPIO not reading inputs

$
0
0

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"


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>