Just finished a pushbutton library that’s pretty easy to use -
pushbutton trigger(triggerPin, LOW);
declares a pushbutton named trigger on the pin named by the integer triggerPin; the pushbutton is declared as active low. Then, you can check whether trigger has been pressed using
if ( trigger.isPressed() ) { }
The library uses debouncing and internal resistors. An example sketch (that also uses the Ping library) is available at http://isomk.sdf.org/brokenlcd/labs/arduino/PingTest.pde
The library itself is available via my Arduino page (http://isomk.sdf.org/arduino.html) or via my github repo (http://github.com/brokenlcd/Arduino-Libraries).
February 17, 2010, 4:34am
