diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-25 12:45:29 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-25 12:45:29 +0200 |
commit | cf55157e92ff82b96527bbb474b3a7df6abf6ac1 (patch) | |
tree | 87c55036cb2ed8a27016835051cb035fc4b8163a /puzzle/smoketest/main.cpp | |
parent | be1b5f0d35544582be1f4fa42aed303184ab27a7 (diff) |
fix smoketest
Diffstat (limited to 'puzzle/smoketest/main.cpp')
-rw-r--r-- | puzzle/smoketest/main.cpp | 17 |
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; } + |