Button debounce code

Push buttons don’t give a clean on/off signal to a microcontroller. The value bounces around a little, which can cause a program to see a whole string of button presses instead of one.

There are lots of techniques to clean up the signal and ‘debounce’ the button, both in hardware and software. Hack a Day gathered examples of debounce code in one-post-to-rule-them-all.

These came in handy when we added support for the function button on Bus Pirate v4.

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.