EasyButton icon indicating copy to clipboard operation
EasyButton copied to clipboard

Multiple buttons with Callback per button

Open jannies opened this issue 2 years ago • 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(); }

jannies avatar Nov 07 '22 19:11 jannies

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

stokni avatar Jan 15 '23 12:01 stokni