blob: 6b4d7d0580ca0b8998b090af1e3b1a2126df68ba (
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
27
28
29
|
#include <Arduino.h>
#include "lib/pbdrv/pb-types.h"
#include "lib/pbdrv/pb-mod.h"
#define EXTERNAL_LED_PIN 13
#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;
}
|