// Button Bounce counter
//
// Red button has bouncing simulation enabled,
// Blue button has bouncing simulation disabled.
#define BUTTON_PIN 4
void setup() {
Serial.begin(115200);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
int lastState = HIGH;
void loop() {
int value = digitalRead((BUTTON_PIN));
if (lastState != value) {
lastState = value;
if (value == HIGH) {
Serial.println(" released");
}
if (value == LOW) {
Serial.println(" pressed");
}
}
}