3 ms·
>wait for the signal to switch from off to on for say 10ms before you act on the transition That is the worst way to debounce, because it adds 10ms latency for
by mrob 2y ago
>wait for the signal to switch from off to on for say 10ms before you act on the transition
That is the worst way to debounce, because it adds 10ms latency for no good reason. The better way is to act immediately but ignore further inputs for 10ms. You might also want a little bit of analog filtering to improve EMI tolerance, but that shouldn't add more than 1ms latency.
- stonemetal12 2y agoYeah, I probably should have put it your way. It gels better with the next paragraph about ignoring user input for some amount of time after the initial signal.
- appplication 2y agoIt depends on the application. If you wanted to debounce, for example, user autocomplete inputs that will be fed as a search term into your service, generally you would not want to start returning results when a user types the first letter “a” and continues typing, but instead wait for the user to stop typing for a fraction of a second. If you have exceptional resources you may choose to not debounce at all, but for applications with latency behind it, it can make more sense to just wait for the user to signal they are done.