mirror of
https://github.com/jaksatomovic/esp32-clickwheel.git
synced 2025-07-04 11:07:12 -04:00
36 lines
730 B
C++
36 lines
730 B
C++
/////////////////////////////////////////////////////////////////
|
|
|
|
#include "Button2.h"
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
#define BUTTON_PIN 2
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
Button2 button;
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
delay(50);
|
|
Serial.println("\n\nButton Loop Demo");
|
|
|
|
button.begin(BUTTON_PIN);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
void loop() {
|
|
button.loop();
|
|
|
|
|
|
Serial.println(button.clickToString(button.wait()));
|
|
Serial.println(button.getNumberOfClicks());
|
|
|
|
|
|
|
|
}
|
|
/////////////////////////////////////////////////////////////////
|