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

isPressed()

Examples
#include <Button.h>

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

void setup()
{
  pinMode(WLED, OUTPUT);
}

void loop()
{
  if (button.isPressed())
  {
    digitalWrite(WLED, HIGH);
  }
  else
  {
    digitalWrite(WLED, LOW);
  }
}
Description Return the bitRead(state,CURRENT) of the switch.
Syntax
isPressed()
Returns Boolean: True if button is pressed.
Usage Application
Updated on July 07, 2011 11:09:40pm PDT

Creative Commons License