mathertel / OneButton

An Arduino library for using a single button for multiple purpose input.
http://www.mathertel.de/Arduino/OneButtonLibrary.aspx
Other
920 stars 230 forks source link

event to fire immediately, when button is pressed #139

Closed dpuschek closed 1 month ago

dpuschek commented 3 months ago

Hello,

I tried out OneButton for a project, where I need Short and Long Clicks at two button. That works like a charm! Thank you! But I also need also a normal button, that is fired immediately. So I attached only a attachClick event to the third button and not any "attachLongPress"-event. Unfortunately, this button only works after a short click is released and does nothing when a long press is done or hold. Is there a way to fire immediately with a OneButton event? For this button I just need the 50ms debounce time, so it isn't triggered multiple times by one press. It would be a pity, if I need an additional library for debouncing.

mathertel commented 1 month ago

This event (press) was added in https://github.com/mathertel/OneButton/pull/141 and will be part of the next release.