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 | holdHandler() |
||||
Examples | #include <Button.h> /* Wire like this: GND -----/ button ------ pin 12 */ Button button = Button(12,BUTTON_PULLUP_INTERNAL); void handleButtonHoldEvents(Button &btn) { Serial.println("hold"); for (int i=0; i<10; i++) { digitalWrite(WLED, HIGH); delay(20); digitalWrite(WLED, LOW); delay(20); } digitalWrite(WLED, HIGH); } void setup() { Serial.begin(9800); pinMode(WLED,OUTPUT); button.holdHandler(handleButtonHoldEvents,1500); } 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 when this button is held. | ||||
Syntax | holdHandler(handler, holdTime) |
||||
Parameters |
|
||||
Returns | None | ||||
Usage | Application |