#include <ezButton.h> // ezButton library
#include <ezOutput.h> // ezOutput library
ezButton button(7); // create ezButton object that attach to pin 7;
ezOutput led(9); // create ezOutput object that attach to pin 9;
unsigned long lastCount = 0;
void setup() {
Serial.begin(9600);
button.setDebounceTime(50); // set debounce time to 50 milliseconds
button.setCountMode(COUNT_FALLING);
}
void loop() {
button.loop(); // MUST call the loop() function first
led.loop(); // MUST call the led1.loop() function in loop()
unsigned long count = button.getCount();
if (count != lastCount) {
Serial.println(count);
if ((count % 3) == 0)
led.blink(1000, 1000, 0, 6); // 0 milliseconds OFF, 100 milliseconds ON, start immediately,
// since toggle times is 6. it changes: OFF -> ON, ON -> OFF 6 times <=> blink 3 time
lastCount = count;
}
}