diff --git a/README.md b/README.md index 5a619a0..2423884 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,14 @@ btn.attachClick(handleClick); btn.attachDoubleClick([]() { Serial.println("Double Pressed!"); }); + +// Handler function for MultiClick the button with self pointer as a parameter +static void handleMultiClick(OneButton *oneButton) { + Serial.println("MultiClick pin=%d debouncedValue=%d!", oneButton->pin(), oneButton->debouncedValue()); +} + +// MultiClick button event attachment with self pointer as a parameter +btn.attachMultiClick(handleMultiClick, &btn); ``` ### Don't forget to `tick()` @@ -151,6 +159,9 @@ There is no functional change on them. | ----------------------- | ------------------------------------------------------------------------------ | | `bool isLongPressed()` | Detect whether or not the button is currently inside a long press. | | `int getPressedTicks()` | Get the current number of milliseconds that the button has been held down for. | +| `int pin()` | Get the OneButton pin | +| `int state()` | Get the OneButton state | +| `int debouncedValue()` | Get the OneButton debounced value | ### `tick()` and `reset()` diff --git a/src/OneButton.h b/src/OneButton.h index 25d645e..0525fd3 100644 --- a/src/OneButton.h +++ b/src/OneButton.h @@ -231,6 +231,7 @@ class OneButton int pin() const { return _pin; }; stateMachine_t state() const { return _state; }; int debounce(const int value); + int debouncedValue() const { return debouncedPinLevel; }; }; #endif