Subversion Repositories ESP8266_P1_Meter

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 raymond 1
/*
2
 * Created by ArduinoGetStarted.com
3
 *
4
 * This example code is in the public domain
5
 *
6
 * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-button-library
7
 *
8
 * This example reads the number of the pressed count of a button with debounce and print it to Serial Monitor.
9
 */
10
 
11
#include <ezButton.h>
12
 
13
ezButton button(7);  // create ezButton object that attach to pin 7;
14
 
15
void setup() {
16
  Serial.begin(9600);
17
  button.setDebounceTime(50); // set debounce time to 50 milliseconds
18
  button.setCountMode(COUNT_FALLING);
19
}
20
 
21
void loop() {
22
  button.loop(); // MUST call the loop() function first
23
 
24
  unsigned long count = button.getCount();
25
  Serial.println(count);
26
}