 struct sample_t {
   uint16_t luminance;
   uint16_t temperature;
+  
+  sample_t(uint16_t lum, uint16_t temp)
+  {
+    luminance = lum;
+    temperature = temp;
+  }
 };
 
 const uint8_t STAT_CMD = 2;

void loop()
{
  // Send message with luminance and temperature
  sample_t sample;
  sample.luminance = luminance.sample();
  sample.temperature = temperature.sample();
  int8_t nr = trx.send(&sample, sizeof(sample), SAMPLE_CMD);
  update(nr);
  
  // Send message with battery voltage and statistics every 10 messages
  if (sent % 10 == 0) {
    stat_t stat;
    stat.voltage = AnalogPin::bandgap(1100);
    stat.sent = sent;
    stat.resent = resent;
    stat.received = received;
    stat.failed = failed;
    nr = trx.send(&stat, sizeof(stat), STAT_CMD);
    update(nr);
  }

  // Take a nap
  MSLEEP(200);
}

BitstuffingCodec codec;

// Network configuration
const uint32_t ADDR = 0xc05a0001UL;
const uint16_t SPEED = 4000;

// Virtual Wire Interface Transceiver
#if defined(__ARDUINO_TINYX5__)
VWI::Transceiver trx(Board::D0, Board::D1, &codec);
#else
