How better to process the button usage with MCU (esp32 family, if more detailed) - if task is to control complex button clicking ?
Short click, long click, double-click, triple-click...
Say,
1) single short click - to wake MCU up
2) Next short clicks - for listing the work modes
3) long click - some setup
4) After some pause the single short click - deepsleeping.
Use a timer after wake-up... button down -> timer on if time passed is bigger than x time, then its a long press... button up -> another timer to way for second click if timer1 is off or long = false
No such lib, but a module could be easily built for this fonction
What I am thinking is how does a short click is different than the bouncing in terms of time duration. Once you can answer this I believe you are close to all solutions.
What I am thinking is how does a short click is different than the bouncing in terms of time duration. Once you can answer this I believe you are close to all solutions.
Actually, now thinking about it, there is no difference. At the first bounce you define it was clicked and then if it is a long click after bouncing period it will still be clicked.
Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing. - LennartHennigs/Button2