aboutsummaryrefslogtreecommitdiff
path: root/puzzle/smoketest/main.cpp
blob: dc15e5f41cdf89bb621368b9a0f7d7658df055c1 (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
#include <Arduino.h>
#include "lib/pbdrv/pb-types.h"
#include "lib/pbdrv/pb-mod.h"

#define EXTERNAL_LED_PIN 13
#define BUTTON_PIN 10 // Define the pin where the external button is connected

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;
}

void pb_hook_mod_state_write(pb_global_state_t _state) {
  state = _state;
}

void loop() {
	digitalWrite(EXTERNAL_LED_PIN, state == PB_GS_PLAYING);

	if (!digitalRead(BUTTON_PIN)) return;
	state = PB_GS_SOLVED;
}