Libraries \ Button

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Class

Button

Name

releaseHandler()

Examples
#include <Button.h>

/*
  Wire like this:
 GND -----/ button ------ pin 12
 */
Button button = Button(12,BUTTON_PULLUP_INTERNAL);

void handleButtonReleaseEvents(Button &
btn)
{
  Serial.println("release");
  digitalWrite(WLED,LOW);
}
void setup()
{
  Serial.begin(9800);
  pinMode(WLED,OUTPUT);

  button.releaseHandler(handleButtonReleaseEvents);
}

void loop()
{
  button.isPressed(); //update internal state
  /*
    Feel free to do your own processing here. 
   The buttons will be handeled 'automagically' by the handler functions
   */
}
Description Register a handler for releases on this button.
Syntax
releaseHandler(handler)
Parameters
handler buttonEventHandler: The function to call when this button is released.
Returns None
Usage Application
Updated on July 07, 2011 11:09:42pm PDT

Creative Commons License