Libraries/Button

From Wiring

Jump to: navigation, search


This library makes it easy to integrate a Button in your project.

Repository: https://github.com/WiringProject/Wiring/tree/master/framework/libraries/Button

Authored by: Alexander Brevig <alexanderbrevig@gmail.com>

Contents

Description

Interaction is important. You all knew that, but it's worth repeating. Speaking of repeating, the library counts the numbers of presses performed on the Button.

The library enables you to query or poll the state of the button, or wire up event handlers that get called when the right conditions occur. If you want you can also use the internal pullup available in the ATMEGA chip and simply wire from ground to the button. No external pullup/pulldown resistors needed!

Example

Button button(2); //a button wired from ground to pin 2
 
if (button.isPressed()){
  //do something fantastic
}

Constants

  • BUTTON_PULLUP_INTERNAL (default)
  • BUTTON_PULLUP
  • BUTTON_PULLDOWN

Methods

Related

About buttons on Wikipedia

Personal tools