evert-arias/EasyButton

Multiple buttons with Callback per button

jannies opened this issue · 1 comments

I need some help and are not sure if I am doing this correctly.

I am trying to use 2 buttons with different callbacks for the onPressed defined for each button.
When any of the buttons are pressed both callback's are invoked.

See code below:

int timerPin = 0;
int resetPin = 13;

EasyButton timerButton(timerPin);
EasyButton resetButton(resetPin);

void onTimerPressed() {
Serial.println("Timer Pressed);
};

void onResetPressed() {
Serial.println("Reset Pressed");
};

void setup() {

Serial.begin(9600);
timerButton.begin();
timerButton.onPressed(onTimerPressed);

resetButton.begin();
resetButton.onPressed(onResetPressed);
}

void loop() {
timerButton.read();
resetButton.read();
}

Having the same issue with VirtualEasyButton, since this project seems to be abandoned, did you ever found a solution for it?