Button Library
The Button Library is a flexible, high-level interface to hardware buttons for the Arduino.
It was written to provide a "black box" object layer around the software required to use a hardware button, such as the ones in this kit: UW Arduino Kit. It provides the ability to detect button clicks, extended "press and hold" clicks, and can handle button circuits that use the Arduino’s internal pull-up resistors as well as pull-down resistors on a breadboard. Two example programs, with documentation, are provided.
To use the library, download these two ZIP archives, and follow the instructions below:
ButtonLib.zip
: code libraries and example programs to be installed in the Arduino applicationButtonLibDocs.zip
: schematics, breadboard layouts, and photos in order to use the example programs
Instructions:
- Use the Arduino Library Manager to install
ButtonLib.zip
. Find this in the Arduino menus as:Sketch|Include Library|Manage Libraries…
orSketch|Include Library|Add .ZIP Library…
- If you are using an older version of Arduino that doesn’t have support for the Library Manager, or want more detailed instructions, see this tutorial: arduino.cc/en/Guide/Libraries.
- Unzip the
ButtonLibDocs.zip
file for supporting documentation about using this library. There are schematics, breadboard layouts, and photos of the builds you will need to use the example programs that accompany the library. - In the Arduino menus, look in
File|Examples|ButtonLib
. (You may need to quit and restart the Arduino application.) You should see two example programs:ButtonDemo
andButton3Demo
. OpenButtonDemo
first, and explore that. The comments in it should tell you everything you need to know to use the library.Button3Demo
is a more complicated example that demonstrates using multiple button objects with the library.
If you have questions or problems with the Button Library, just contact us fizzers at fizzlab at uw.edu. Happy buttoneering.