Written: 31 May 2014
Last Updated: 25 July 2015
Article History (newest on top)
-added button image & updated download links - 25 July 2015
Other Articles to Check Out:
- The Power of Arduino <-- be sure to check out the various really useful Arduino-related links at the bottom of this post! They have helped me a ton.
- The Goal of a Lifetime
- Arduino micros() function with 0.5us precision - using my Timer2_Counter "Library"
- Arduino Power, Current, and Voltage Limitations
- Quick Tip: 4 Ways to Power an Arduino
- Parallel Charging Your LiPo Batteries
- Beginner RC Airplane Setup
- Thunder AC680/AC6 Charger & Computer Data-Logging Software
- All articles on my blog with the label "Arduino" - http://electricrcaircraftguy.blogspot.com/search/label/Arduino
Library History (newest on top):
20141031: major bug fix; added multi-button support with a new 5-button-reader example!
20140531: first release.
Misc. push buttons which can greatly benefit from digital debouncing. (Image source here). |
Summary:
I wanted a simple and universal, yet very powerful & reliable library to read a button or switch in such a way that I can easily implement toggled actions and momentary actions, know the true, debounced state of a button or switch at any given time, and specify whether I want an action to take place when the button is *pressed* or *released.* This library makes implementing all of these things easy for me, and I now use it on all of my projects that require reading a button or switch, so I wanted to share it with others. Hopefully you find it useful too. Check out the included examples.
This code is an elaboration of, and library form of, the main Arduino-sponsored "Debounce" example found here. Thanks to David A. Mellis, Limor Fried (LadyAda), and Mike Walters for writing that excellent and well-thought-out example code.
Download:
(Optionally) donate, & download via the link just above, or by clicking here then choosing the appropriate download. Install the library into the Arduino IDE (using Sketch --> Include Library --> Add .ZIP Library), then run the examples to see how to use the library.