-
Notifications
You must be signed in to change notification settings - Fork 0
Button
Alex Krieg edited this page May 25, 2018
·
12 revisions
- Button(int pinNr, boolean logicLevel = activeHigh);
- ~Button();
- void update();
- void OnPressedEdge(void (*p_func)());
- void OnReleasedEdge(void (*p_func)());
- void OnBothButtonEdges(void (*p_func)());
- void IsPressedHigh(void (*p_func)());
- void IsPressedLow(void (*p_func)());
- virtual boolean getValue();
- int getPin();
- Constructor
- Needs a pinNr for the button an a logicLevel.
If voltage rises up when the button is pressed,logicLevel = avtiveHigh
If voltage falls when the button is pressed,logicLevel = activeLow
Button myButton(3);
Button myButton(3,activeHigh);
Button myButton(3,activeLow);
- Destructor
delete &myButton;
- Reads the state of the button.
- If any event Function is defined, it will run these in certain conditions.
myButton.update();
You do not know how events work?
Look over here
- Is executed when a rising edge of the button is detected.
- No values accepted.
- NO return values.
- Is executed when a falling edge of the button is detected.
- No values accepted.
- NO return values.
- Is executed when a any edge of the button is detected.
- NO values accepted.
- NO return values.
- Is executed when the button is pressed.
- No values accepted.
- NO return values.
- Is executed when the button isn't pressed.
- No values accepted.
- NO return values.
- Returns the active state of the button pin.
bool state = myButton.getValue();
- Returns the pin on which the button is connected to.
int buttonPin = myButton.getPin();
Wiki
Arduino libraries