Search wiring.org.co:

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 |

### pressHandler()

Examples |
    #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
       */
    }
Description | Register a handler for presses on this button.
Syntax |
    pressHandler(handler)
Parameters |

handler | buttonEventHandler: The function to call when this button is pressed

Returns | None
Usage | Application

Updated on July 07, 2011 11:09:41pm PDT