Button Method Library

Last updated Carlyn Maw Jan 2008

Overview

To help make basic button functions easier. Includes a debounce.

Download and Install

Basic Setup

The first thing you need to do (after installing the library) is put the following line at the top of your code:

  1. include <Button.h>

The next is create in instance of a button. Normally attach a button to a pin and start listening to it you have to set the pin mode in the setup loop. Here you define a button object with the other global variables before that. So to define a button on Pin 5 you'd need to pick a name (in this case "myButton") and include the following:

Button myButton = Button(5);

Now you are ready to have "myButton" do things in the main loop.

Basic Usages

isPressed()/isReleased()

onPress()/onRelease()

onDoubleClick()

More (changing the defaults and the second constructor)

Share