#include <ezButton.h>
#define DEBOUNCE_TIME 50 // the debounce time in millisecond
ezButton button1(21); // create ezButton object that attach to pin GPIO21
ezButton button2(22); // create ezButton object that attach to pin GPIO22
ezButton button3(23); // create ezButton object that attach to pin GPIO23
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// Set debounce time to 50 milliseconds
button1.setDebounceTime(DEBOUNCE_TIME);
button2.setDebounceTime(DEBOUNCE_TIME);
button3.setDebounceTime(DEBOUNCE_TIME);
}
void loop() {
// put your main code here, to run repeatedly:
// MUST call the loop() function first
button1.loop();
button2.loop();
button3.loop();
if (button1.isPressed())
Serial.println("The button 1 is pressed");
if (button1.isReleased())
Serial.println("The button 1 is released");
if (button2.isPressed())
Serial.println("The button 2 is pressed");
if (button2.isReleased())
Serial.println("The button 2 is released");
if (button3.isPressed())
Serial.println("The button 3 is pressed");
if (button3.isReleased())
Serial.println("The button 3 is released");
}