Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting multiple clicks returns wrong values for > 2 #132

Open
theclayman opened this issue Nov 12, 2023 · 0 comments
Open

Detecting multiple clicks returns wrong values for > 2 #132

theclayman opened this issue Nov 12, 2023 · 0 comments

Comments

@theclayman
Copy link

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 theclayman changed the title Detecting multiple clicks returns wrong values for > 3 Detecting multiple clicks returns wrong values for > 2 Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant