mathertel/OneButton

attachMultiClick function not working #82

dotnetwise opened this issue · 1 comments

As the #82 was previously mentioned I am experiencing the same behavior
May I please know how to use multi click e.g. triple click detection?

Checked with the InterruptOneButton example that is works (as of now).

You can code any n-click detection by:

// this function will be called when the button was pressed multiple times in a short timeframe.
void multiClick() {
  int n = button.getNumberClicks();
  if (n == 3) {
    Serial.println("tripleClick detected.");
  } else if (n == 4) {
    Serial.println("quadrupleClick detected.");
  } else {
    Serial.print("multiClick(");
    Serial.print(n);
    Serial.println(") detected.");
  }

  ledState = !ledState; // reverse the LED
  digitalWrite(PIN_LED, ledState);
} // multiClick