Copy of the code found at http://playground.arduino.cc//Code/Bounce