Saturday, 21 December 2013 22:21

Debouncing Multiple Switches

Written by
If you want to input a manual switch signal into a digital circuit you'll need to debounce the signal so a single press doesn't appear like multiple presses. 
 
There is a Bounce library for Arduino which is very easy to use. However there is limitations with this Bounce library.
  • You are unlikely to enable the internal pull-up resistor on switch pins, therefore each switch require an external pull-up resistor
  • It is not possible to detect the switch state before main loop (setup). When you press a switch during power on, you will never get the state of the switch.
 
 
Adafruit wrote an example code for multi-button checker with debouncing which will solve that two problems.
 
I'm modifying the example code, it is useful if you want something to only happen once when a button is pressed.

Read 49705 times Last modified on Sunday, 12 June 2016 11:42

75 comments

Leave a comment

Back to Top