aboutsummaryrefslogtreecommitdiff
path: root/puzzle/smoketest/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'puzzle/smoketest/main.cpp')
-rw-r--r--puzzle/smoketest/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/puzzle/smoketest/main.cpp b/puzzle/smoketest/main.cpp
index dc15e5f..6b4d7d0 100644
--- a/puzzle/smoketest/main.cpp
+++ b/puzzle/smoketest/main.cpp
@@ -3,15 +3,10 @@
#include "lib/pbdrv/pb-mod.h"
#define EXTERNAL_LED_PIN 13
-#define BUTTON_PIN 10 // Define the pin where the external button is connected
+#define BUTTON_PIN 10
pb_global_state_t state = PB_GS_NOINIT;
-void setup() {
- pinMode(EXTERNAL_LED_PIN, OUTPUT);
- pinMode(BUTTON_PIN, INPUT_PULLUP);
-}
-
pb_global_state_t pb_hook_mod_state_read() {
return state;
}
@@ -20,9 +15,15 @@ void pb_hook_mod_state_write(pb_global_state_t _state) {
state = _state;
}
+void setup() {
+ pinMode(EXTERNAL_LED_PIN, OUTPUT);
+ pinMode(BUTTON_PIN, INPUT_PULLUP);
+}
+
void loop() {
digitalWrite(EXTERNAL_LED_PIN, state == PB_GS_PLAYING);
- if (!digitalRead(BUTTON_PIN)) return;
- state = PB_GS_SOLVED;
+ if (!digitalRead(BUTTON_PIN)) // button is inverted
+ state = PB_GS_SOLVED;
}
+