marvinroger / arduino-shutters

Arduino library to control non-smart roller shutters using time
MIT License
60 stars 17 forks source link

Detecting multiple clicks returns wrong values #32

Closed theclayman closed 11 months ago

theclayman commented 11 months ago

Hello,

first thanks for this great library which saves me a lot of time for developing my smart home shutter control. I try to detect and count multiple clicks of a button, but the results for multiple clicks > 2 are not correct, while detecting single and double clicks works correctly. This is my code:

`
rollo1_taster_hoch = OneButton( CONTROLLINO_A0, // Input pin for the button false, // Button is active high true // Enable internal pull-up resistor ); rollo1_taster_hoch.attachMultiClick(handleMultiClick);

static void handleMultiClick(OneButton *oneButton) { Serial.print("Number of clicks: "); Serial.print(oneButton->getNumberClicks()); if(oneButton->getNumberClicks() == 5) { Serial.println("5 klicks"); } }

` For 3 clicks the serial output is: "Number of clicks 55" For 4 clicks: Number of clicks 0 For 5 clicks: Number of clicks 768 For 6 clicks: Number of clicks 771

These values are reproducible when clicking the same number of times again.

Does anyone have an idea what could cause these wrong values?

theclayman commented 11 months ago

sorry posted in wrong issue tracker