Bounce is a library for Arduino (arduino.cc). It debounces digital inputs and more.

Download the latest version from github:

"Wait, what, those links are for Bounce2!!!!?"

The 2 indicates this is the second version of the Bounce library. It also indicates it is not 100% compatible with the previous version. The library has been upgraded with better algorithms and modifications suggested by various users.

How to upgrade from version 1 to version 2?

Please look at the examples included with the library for more information. But the biggest change is the following :

Change the creation of the object

  • from:
 Bounce bouncer = Bounce(inputPin, 5);
  • to :
 Bounce  bouncer  = Bounce(); 

Initialize the object in setup

  • from :
 *not required with the previous version
  • to (inside setup) :
 // Setup the button
 pinMode( inputPin ,INPUT);
 // Activate internal pull-up (optional) 
 digitalWrite( inputPin ,HIGH);

 // After setting up the button, setup the object
 bouncer .attach( inputPin );
 bouncer .interval(5);

Share