ClickButton Defaults - distinguishing between short and long click

Hello,

I am new to the Particle community and am testing out the Grove Sensor kit button with the ClickButton library. With the library defaults for debounceTime, multiclickTime, and longClicktime, and the Grove Button as an input, single short clicks register as a long click despite clicking the button as fast as possible. I tried modifying the variable defaults however haven’t been able to adjust them to distinguish between a short and a long press. Is this achievable with the library? If so, can someone advise what changes should be made to the defaults? Thanks!

That’s probably due to the wrong polarity selected in your code.
The Grove Sensor Kit button is active HIGH, but the ClickButton library example assumes an active LOW button.
You should use this constructor

ClickButton button1(buttonPin1, HIGH);
2 Likes

@ScruffR, thanks that worked! Cheers.

1 Like