Download, install and import
Download here: Attach:Debounce.zip
Put the Debounce folder in "hardwarelibraries".
In the Arduino IDE, create a new sketch (or open one) and
select from the menubar "Sketch->Import Library->Debounce".
Once the library is imported, an "#inlcude Debounce.h" line will appear
at the top of your Sketch.
CREATION
Debounce(unsigned long debounceTime, byte pin)
Instanciates a Debounce object with a debounce time and a digital pin number.
Because Debounce does not use interrupts, you have to "update" the Debounce before reading its value.
Methods
int update()
Updates Debounce. Returns true if the pin state changed (HIGH to LOW or LOW to HIGH). False if not.
void interval(unsigned long interval)
Changes the debounce time in milliseconds.
int read()
Reads the update pin state correct for debouncing.
void write(int state)