#include <EasyButton.h>
// Arduino pin number where the button is connected.
#define BUTTON_PIN 4
// Button.
EasyButton button(BUTTON_PIN);
// Callback.
void onPressed() {
Serial.println("Button has been pressed!");
}
void setup() {
Serial.begin(115200);
Serial.println("Button 00000");
// Initialize the button.
button.begin();
// Attach callback.
button.onPressed(onPressed);
}
void loop() {
// Continuously update the button state.
button.read();
}