Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

Bounce is a library for Arduino. It debounces digital inputs and more.

Download the latest version from github

Questions?

Please ask questions in the official forum instead of my personal mail.

Links

What is Bounce2?

The 2 indicates that this is the second version of the Bounce library. It also indicates that it is not 100% compatible with the previous version. The library has been upgraded with different 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);