Hi there,
If I simply read the input, it returns correct pin status. If I implement add_event_detect, GPIO.input always return the same value no matter in the event callback or other place in the code. Meanwhile, I also check /sys/class/gpio/ and found that the gpio value is correct. My system is NanoPi Neo Core with official ROM released at 2021/04/25. I test my test code on Raspberry Pi 3B. There is no problem at all.
`
def btnPrint(pin):
time.sleep(0.1)
print("Press1:",GPIO.input(pin))
time.sleep(0.1)
print("Press2:",GPIO.input(pin))
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(62, GPIO.IN)
GPIO.add_event_detect(62, GPIO.RISING, callback=btnPrint, bouncetime=1000)
while 1:
print("main status 1:",GPIO.input(62))
time.sleep(5)
print("main status 2:",GPIO.input(62))
time.sleep(5)
`
Hi there,
If I simply read the input, it returns correct pin status. If I implement add_event_detect, GPIO.input always return the same value no matter in the event callback or other place in the code. Meanwhile, I also check /sys/class/gpio/ and found that the gpio value is correct. My system is NanoPi Neo Core with official ROM released at 2021/04/25. I test my test code on Raspberry Pi 3B. There is no problem at all.
`
def btnPrint(pin):
time.sleep(0.1)
print("Press1:",GPIO.input(pin))
time.sleep(0.1)
print("Press2:",GPIO.input(pin))
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(62, GPIO.IN)
GPIO.add_event_detect(62, GPIO.RISING, callback=btnPrint, bouncetime=1000)
while 1:
print("main status 1:",GPIO.input(62))
time.sleep(5)
print("main status 2:",GPIO.input(62))
time.sleep(5)
`