Arduino-GPIO
General Purpose Input/Output (GPIO) library for Arduino
Button.ino
Go to the documentation of this file.
1 #include "GPIO.h"
2 #include "Button.h"
3 
4 #include "Software/Serial.h"
7 
8 void setup()
9 {
10  Serial.begin(57600);
11  while (!Serial);
12 }
13 
14 void loop()
15 {
16  if (button.ischanged()) {
17  Serial.print(button.timestamp());
18  Serial.print(':');
19  Serial.println(button ? F("released") : F("pushed"));
20  }
21 }
void begin(uint32_t baudrate)
Definition: Serial.h:50
Definition: Button.h:31
void setup()
Definition: Button.ino:8
bool ischanged()
Definition: Button.h:50
Button< BOARD::D1 > button
Definition: Button.ino:6
Software::Serial< BOARD::D0 > Serial
Definition: Button.ino:5
void loop()
Definition: Button.ino:14
uint16_t timestamp()
Definition: Button.h:86