-
Notifications
You must be signed in to change notification settings - Fork 0
Button.h
Brandon W. Kipp edited this page Feb 13, 2020
·
1 revision
This library is used to help debounce digital input signals.
To setup a new Button
, you'll need to pass in two parameters:
-
int
pin, location of the input pin -
void (*callback)(int)
, a callback function that accepts the returnedint
value of the sensor
#include "Libraries/Button.h"
Button button1;
int button1Pin = 2;
void setup() {
button1.setup(button1Pin, [](int state) {
if (state == 1) {
// This means, our button was pressed
// We should do something, like turn on a light
}
});
}
void loop() {
button1.update();
}