 #include "Cosa/IOStream/Driver/UART.hh"
 #include "Cosa/RTC.hh"
 #include "Cosa/Watchdog.hh"
+#include "Cosa/Time.hh"
+#include "Cosa/Periodic.hh"
 
 // Configuration
 #define NO_INDOORS

#endif

// Start time in milli-seconds
const uint32_t START = 0xfffff000UL;

void setup()
{

  RTC::begin();
  Watchdog::millis(START);
  RTC::millis(START);
  clock.time(START / 1000);
}

void loop()
{
  // Periodically read and print humidity and temperature
  periodic(timer, 2000) {
#if !defined(NO_INDOORS)
    trace << time_t(clock.time()) << ':';
    trace << hex << RTC::micros() << PSTR(":indoors: ");
    if (indoors.sample())
      trace << indoors;
    else
      trace << PSTR("failed");
    trace << endl;
#endif
    trace << time_t(clock.time()) << ':';
    trace << hex << RTC::micros() << PSTR(":outdoors: ");
    if (outdoors.sample())
      trace << outdoors;
    else
      trace << PSTR("failed");
    trace << endl;
  }
  yield();
}
