mirror of
https://github.com/jaksatomovic/esp32-clickwheel.git
synced 2025-07-04 11:07:12 -04:00
39 lines
910 B
C++
39 lines
910 B
C++
/////////////////////////////////////////////////////////////////
|
|
#include "Button2.h"
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
Button2 button;
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
byte myButtonStateHandler() {
|
|
return digitalRead(39);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
void myTapHandler(Button2 &b) {
|
|
Serial.println("tap");
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
delay(100);
|
|
Serial.println("\n\nCustom Buttom Test");
|
|
button.begin(VIRTUAL_PIN);
|
|
|
|
pinMode(39, INPUT_PULLUP);
|
|
|
|
button.setButtonStateFunction(myButtonStateHandler);
|
|
button.setTapHandler(myTapHandler);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
void loop() {
|
|
button.loop();
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|