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 detects the pressed and released events of a button without debounce.
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
}
18
 
19
void loop() {
20
  button.loop(); // MUST call the loop() function first
21
 
22
  if(button.isPressed())
23
    Serial.println("The button is pressed");
24
 
25
  if(button.isReleased())
26
    Serial.println("The button is released");
27
}