Changed the default stateForPressed and fixed example

This commit is contained in:
Thomas O Fredericks
2020-05-21 15:45:52 -04:00
parent 1af864b0bd
commit 6147a34058
2 changed files with 7 additions and 9 deletions
+4 -6
View File
@@ -18,7 +18,7 @@
#define BUTTON_PIN_B 3
#define LED_PIN 13
#define LED_PIN LED_BUILTIN
// Instantiate a Button object
Button buttonA = Button();
@@ -50,12 +50,10 @@ void loop() {
buttonB.update();
// TURN ON LED IF EITHER BUTTON IS PRESSED
// TOGGLE THE LED IF EITHER BUTTON IS PRESSED
if ( buttonA.pressed() || buttonB.pressed() ) {
digitalWrite(LED_PIN, HIGH );
digitalWrite(LED_PIN, !digitalRead(LED_PIN) );
}
else {
digitalWrite(LED_PIN, LOW );
}
}