pjueon / JetsonGPIO

A C++ library that enables the use of Jetson's GPIOs
MIT License
287 stars 102 forks source link

how use "wait_for_edge" function that eliminate key jitter? #74

Closed jcyhcs closed 2 years ago

jcyhcs commented 2 years ago

hi,professor: i use wait_for_edge function, detect button pushed when GPIO::EDGE::FALLING, but sometimes it got one, and sometime it got multi events, so , what can i do? eliminate the mistake trgger? thanks , please help me!

pjueon commented 2 years ago

Hi. have you tried to set debounce time for the wait_for_edge function?

for example:

// debounce_time set to 10ms
// no timeout
GPIO::wait_for_edge(channel, GPIO::RISING, 10);

If you already set the debounce time, what happens if you increase it? Does it fix your issue?

And could you give us the information of your HW setup? I'm not familiar with HW stuff at all, but somebody else may give you some advice that can fix your issue from the HW aspect.

pjueon commented 2 years ago

No response for a long time, closing it for now.