peacemaker Expert Licensed User Longtime User Jul 6, 2025 #1 Hi, All 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. Any lib for such button usage ?
Hi, All 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. Any lib for such button usage ?
Cableguy Expert Licensed User Longtime User Jul 6, 2025 #2 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 Upvote 0
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
hatzisn Expert Licensed User Longtime User Jul 6, 2025 #3 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. Upvote 0
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.
hatzisn Expert Licensed User Longtime User Jul 6, 2025 #4 hatzisn said: 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. Click to expand... 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. Upvote 0
hatzisn said: 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. Click to expand... 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.
Cableguy Expert Licensed User Longtime User Jul 6, 2025 #5 You set a minimal timer1 duration so that button down is true, then on button up set Timer1 off, and start timer 2 to detect second click Upvote 0
You set a minimal timer1 duration so that button down is true, then on button up set Timer1 off, and start timer 2 to detect second click
peacemaker Expert Licensed User Longtime User Jul 7, 2025 #6 GitHub - LennartHennigs/Button2: Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing. Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing. - LennartHennigs/Button2 github.com it needs to wrap... Upvote 0
GitHub - LennartHennigs/Button2: Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing. Arduino/ESP button library that provides callback functions to track single, double, triple and long clicks. It also takes care of debouncing. - LennartHennigs/Button2 github.com it needs to wrap...
peacemaker Expert Licensed User Longtime User Jul 30, 2025 #7 Hope25 said: the OneButton library is a great choice Click to expand... thanks, i have already made a workaround: https://www.b4x.com/android/forum/t...short-click-long-click-periodic-event.167699/ Upvote 0
Hope25 said: the OneButton library is a great choice Click to expand... thanks, i have already made a workaround: https://www.b4x.com/android/forum/t...short-click-long-click-periodic-event.167699/