blob: 35a4ec9be8d6e6fb317a8f17f9ad1395662a2578 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "lib/pbdrv/pb-mod.h"
#include "lib/pbdrv/pb-types.h"
#include <Arduino.h>
//! LED pin (on-board LED on Arduino Uno board) \ingroup puz_smoketest
#define EXTERNAL_LED_PIN 13
//! External button pin (button shorts this pin to ground) \ingroup puz_smoketest
#define BUTTON_PIN 10
pb_global_state_t state = PB_GS_NOINIT;
pb_global_state_t pb_hook_mod_state_read() { return state; }
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)) // button is inverted
state = PB_GS_SOLVED;
}
|