I'm trying to read from all my Raspberry Pi B+ GPIOs. Using the Python3 RPi.GPIO
library, it is quite easy to do, but I've come across a problem that I can't seem to resolve :
GPIO 17 does not trigger callbacks
I don't know if it's me, the library or the hardware; I'm using a very standard Rapsbian, no fancy stuff, on a stock Raspberry Pi B+. I've tested this on different boards (all new) but same behavior everywhere.
Quick and dirty test script :
import RPi.GPIO as GPIO
pin = 17
GPIO.setmode(GPIO.BCM)
def callback(channel):
print("Callback trigger (%d)" % channel)
GPIO.setup(pin, GPIO.IN, GPIO.PUD_DOWN)
GPIO.add_event_detect(pin, GPIO.RISING, callback=callback, bouncetime=300)
while(True):
if (GPIO.input(pin) == 1):
print("Direct trigger")
If you run this with say, a button attached between 3V3 and GPIO 17 (PIN 1-11), and push it, you will never reach the callback function. Never. But the pin will correctly report its state, and the print
statement in the while
will get executed as expected.
If you run this script on any other pins, you get to see the print
function from the callback AND the print
function from the while
loop.
Any ideas ? I feel lost !
Thanks a lot !