#include <ezButton.h>
ezButton button(7); // create ezButton object that attach to pin 7;
//int buzz= 8;
void setup() {
Serial.begin(9600);
button.setDebounceTime(50); // set debounce time to 50 milliseconds
button.setCountMode(COUNT_RISING);//For counting
}
void loop() {
button.loop(); // MUST call the loop() function first
if(button.isPressed()){
unsigned long count = button.getCount();
//
Serial.print("The button is pressed: ");
Serial.println(count);
int mode=count%5;//remainder=1,2,3,4,0
Serial.print("Mode= ");
Serial.println(mode);
}
}