OneButton
OneButton copied to clipboard
New Callback attachHappenAfterTickNumber added
Hi, I have added a new callback to the system. It is called when the user presses the desired amount of buttons.
Here is the example usage :
#include <Arduino.h>
#include "src/OneButton.h">
class Button{
private:
OneButton button;
int value;
public:
explicit Button(uint8_t pin):button(pin) {
button.setAfterTicks(5);
button.attachHappenAfterTickNumber([](void *scope){ ((Button *) scope)->happenAfterTick();}, this);
}
void handle(){
button.tick();
}
void happenAfterTick() {
Serial.println("Function called after counts");
}
};
Button button(8);
void setup() {
Serial.begin(115200);
}
void loop() {
button.handle();
}