-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Is it possible to have multiple buttons, each on a different pin? I tried this with no luck:
BfButton btn2(BfButton::STANDALONE_DIGITAL, 4, false, LOW); // I added a pulldown myself
void pressHandler (BfButton *btn, BfButton::press_pattern_t pattern) {
Serial.print(btn->getID());
}
void setup() {
btn1.onPress(pressHandler)
.onDoublePress(pressHandler, 1000) // default timeout
.onPressFor(pressHandler, 1000); // custom timeout for 1 second
btn2.onPress(pressHandler)
.onDoublePress(pressHandler, 1000) // default timeout
.onPressFor(pressHandler, 1000); // custom timeout for 1 second
}
void loop() {
btn1.read();
btn2.read();
}```
I have enough pins that I do not need to worry about an array on a single pin and would rather not as I will be using the same code in multiple devices and readings may vary.
Metadata
Metadata
Assignees
Labels
No labels