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:

  • code libraries and example programs to be installed in the Arduino application
  • schematics, breadboard layouts, and photos in order to use the example programs


  1. Use the Arduino Library Manager to install Find this in the Arduino menus as:
    • Sketch|Include Library|Manage Libraries… or
    • Sketch|Include Library|Add .ZIP Library…
  2. 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:
  3. Unzip the 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.
  4. 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 and Button3Demo. Open ButtonDemo 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 Happy buttoneering.