Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple buttons with Callback per button #75

Open
jannies opened this issue Nov 7, 2022 · 1 comment
Open

Multiple buttons with Callback per button #75

jannies opened this issue Nov 7, 2022 · 1 comment

Comments

@jannies
Copy link

jannies commented Nov 7, 2022

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();
}

@stokni
Copy link

stokni commented Jan 15, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants