Download this file
#include "leffakone_timer.h"
#include "timer.h"
#include "blinker.h"
#include "Scheduler.h"
#include "listener.h"
#include "state_machine.h"

#undef ENABLE_RESET

WakeupTimer wakeup_timer;
ResetTimer reset_timer;
Blinker blinker(BLINKER_COUNTDOWN_RATE);
Listener listener;

StateMachine state_machine(&wakeup_timer, &reset_timer, &blinker);


Task * tasks[] = { &wakeup_timer, &reset_timer, &blinker, &listener };
TaskScheduler scheduler(tasks, NB_ELEMENTS(tasks));


void setup() {
  Serial.begin(57600);
  wakeup_timer.set_state_machine(&state_machine);
  reset_timer.set_state_machine(&state_machine);
  listener.set_state_machine(&state_machine);

  // switch onboard LED off
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

void loop() {
  scheduler.run(); // infinite loop
}