Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO.input read the same value after implementing add_event_detect #45

Open
est-oliveryang opened this issue Aug 5, 2022 · 1 comment

Comments

@est-oliveryang
Copy link

est-oliveryang commented Aug 5, 2022

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)
`

@bogdanvb
Copy link

bogdanvb commented Jun 7, 2024

i have same problem in nanopi neo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants