Librerías \ Button

Referencia para la versión de Wiring 1.0 Build 0100+. Si tiene una versión previa, use la referencia incluida con su software. Si encuentra errores o tiene comentarios, no dude en contactarnos.

Clase

Button

Nombre

pressHandler()

Ejemplos
#include <Button.h>

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

void handleButtonPressEvents(Button &btn)
{
  Serial.println("press");
  digitalWrite(WLED,HIGH);
}
void setup()
{
  Serial.begin(9800);
  pinMode(WLED,OUTPUT);

  button.pressHandler(handleButtonPressEvents);
}

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
   */
}
Descripción Define una función que será llamada cuando el botón sea presionado.
Sintaxis
pressHandler(handler)
Parámetros
handler buttonEventHandler: La función que será llamada cuando el botón este presionado.
Retorna Ninguno
Uso Application
Updated on July 07, 2011 11:14:21pm PDT

Creative Commons License