LennartHennigs / Button2

Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
MIT License
487 stars 81 forks source link

setStateHandler Functions #63

Closed woodenplastic closed 8 months ago

woodenplastic commented 10 months ago

Hi,

is there a way to call functions with values like:

button1.setButtonStateFunction(buttonstate(i)).

So i can use one state function for different buttons?

All the best and love Adrian

LennartHennigs commented 9 months ago

Hey Adrian,

you can assign the same callback function for different buttons. Currently you cannot pass additional parameters to the callback.

But all callback include a reference to the source button. This allows you to differentiate between the buttons. See MultiHandlerTwoButtons.

Is this what you had in mind?