Timeline for I need help debouncing a push button
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 1, 2020 at 17:22 | comment | added | user57037 | For buttons, polling every 10 or 50 ms works well in practice. Missing button presses that last less than 50ms is not a problem, as these are very fleeting button presses that were probably done by accident. Maye for a game controller it might be important to reduce latency. But for many normal buttons it is fine. | |
Nov 30, 2020 at 20:18 | comment | added | Kartman | @mituraj. I’m confused. The technique of sampling is based on DSP techniques and you’re saying its crude and unreliable? Have you read Ganssle’s work? | |
Nov 30, 2020 at 4:16 | comment | added | Mitu Raj | This is not a place for me to answer. Chris has already mentioned in his comment more reliable method. You can research on that as it's popular in embedded coding to debounce using counters/shift registers. | |
Nov 29, 2020 at 20:06 | comment | added | Kartman | @mituraj. If polling is crude, what would you suggest is a more suitable technique? Suggesting an interrupt would be worse - you want sub microsecond response for an input that is derived from slow human input? What about EMC effects? | |
Nov 27, 2020 at 11:03 | comment | added | Mitu Raj | @Kartman if you poll every 10 ms, possibility of misreading the same event for multiple times is there. Imagining the switch is poor in debouncing and is triggering an interrupt in the code. If you increase the polling time, possibility of missing an event increases. Gotta find a trade off between two. But still this is a crude method. | |
Nov 27, 2020 at 7:29 | comment | added | Kartman | If you poll every 10ms are you concerned about missing a sub 10ms pushbutton event? If it is sub 10ms, then it is unlikely it is a valid pushbutton press. | |
Nov 27, 2020 at 4:57 | comment | added | Chris Stratton | Actually polling every time T isn't a great idea, as this can lead to missing events entirely. Typically what you want to do is detect the leading event immediately and then ignore any subsequent input for time T. A variation is to detect closure, but wait to act until the button has been released for an entire time T. | |
Nov 26, 2020 at 21:09 | history | answered | Neil_UK | CC BY-SA 4.0 |