Skip to content

Detecting multiple clicks returns wrong values for > 2 #132

Open
@theclayman

Description

@theclayman

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions