Quantcast
Viewing all articles
Browse latest Browse all 2

Python GPIO not reading inputs

Image may be NSFW.
Clik here to view.
enter image description here
Using a very simple input script to read a button press, Python GPIO isn't reading high when the button is pressed. The wiring is correct - I have checked it using wiringpi readall.

Rpi. GPIO has been updated and is current and I've run the pintest script to test all pins are OK.

Is there anything I'm missing that could cause Rpi. GPIO to miss a high input pin that wiringpi is detecting?

My code is:

import RPi.GPIO as GPIO  GPIO.setmode(GPIO.BCM)GPIO.setup(13, GPIO.IN) try:      while True:                   if GPIO.input(13):              Print("button pressed")

Edit:I should have mentioned that I've already tried the pull up/downs, and even tried using physical resistors - still the same result (Without the resistors, I can see from wiringpi that the input is floating.)

I'm not at home to send a photo of the wiring - here's a sketch of the setup. However, I don't believe the physical setup is the issue since wiringpi is picking up the input without issue - it's just Python GPIO that's not behaving.


Viewing all articles
Browse latest Browse all 2

Trending Articles



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