#include <ezButton.h>
ezButton button(5); // create ezButton object that attach to ESP8266 pin D7
void setup() {
Serial.begin(115200);
button.setDebounceTime(50); // set debounce time to 50 milliseconds
Serial.println("ezButton TEST");
}
void loop() {
Serial.println("ezButton TEST");
delay(1000);
button.loop(); // MUST call the loop() function first
if (button.isPressed())
Serial.println("The switch: OFF -> ON");
if (button.isReleased())
Serial.println("The switch: ON -> OFF");
int state = button.getState();
if (state == HIGH)
Serial.println("The switch: OFF");
else
Serial.println("The switch: ON");
}