   buffer[0] = MYID;
   buffer[1] = CMD_BOOT;
   radio.Wakeup();
-  radio.Send(GATEWAYID, payload, 10, true);
+  radio.Send(GATEWAYID, buffer, 10, true);
   if (waitForAck(GATEWAYID)) {
     Serial.println("RF Gateway Found - Loading sensor defaults...");
   } else {

    Serial.print("reading [");
    Serial.print(buffer);
    Serial.print("]");

    // send sensor reading message to gateway    
    radio.Send(GATEWAYID, buffer, strlen(buffer), true);
    Serial.print(" - waiting for ACK...");
    if (waitForAck(GATEWAYID)) Serial.println("ok!");
    else Serial.println("nothing...");

    blink_led(DPIN_RF_LED, 5);
    log();
  }
  
}

//------------------------------------------------------------------------------
void blink_led(byte pin, int delay_ms) {
  digitalWrite(pin, HIGH);
  delay(delay_ms);
  digitalWrite(pin, LOW);
}

//------------------------------------------------------------------------------
// Compares each sensor's value against its expectation, returning true if the
// values are acceptable or false if they fall outside the expectations.
int check_status() {
  int status = LOW;
  if (sensorData.ldr > sensorThresholds.light) {
    status = HIGH;
  }
  if (sensorData.hall == sensorThresholds.door) {
    status = HIGH;
  }
  if (sensorData.tempInsideC < sensorThresholds.minTempInsideC) {
    status = HIGH;
  }
  if (sensorData.tempInsideC > sensorThresholds.maxTempInsideC) {
    status = HIGH;
  }
  return status;
}

//------------------------------------------------------------------------------
// Logs the current sensor values.
void log() {
  Serial.print("Light: "); 
  Serial.print(sensorData.ldr);
  Serial.print(" Hall: "); 
  Serial.print(sensorData.hall);
  Serial.print(" Temp: "); 
  Serial.print(sensorData.tempInsideC);
  Serial.print("C, "); 
  Serial.print(sensorData.tempOutsideC);
  Serial.print("C");
  Serial.print(" Battery: "); 
  Serial.println(sensorData.batteryVoltage);
}

//------------------------------------------------------------------------------
// Retrieves the new sensor values.
void interogate_sensors() {

  // block access to sensor data  
  sensorData.available = false;
  
  // read light level
  sensorData.ldr = map(analogRead(APIN_LDR), 0, 1023, 0, 255);

  // read door status
  sensorData.hall = digitalRead(DPIN_HALL);
  
  // read one-wire sensors
  oneWireSensors.requestTemperatures();
  sensorData.tempInsideC = oneWireSensors.getTempC(thermometerInside);
  sensorData.tempOutsideC = oneWireSensors.getTempC(thermometerOutside);
  
  // read battery voltage
  int val = analogRead(APIN_BATTERY);
  float pinVoltage = val * 0.00488;
  sensorData.batteryVoltage = pinVoltage * VDD_RATIO;

  // enable access to sensor data  
  sensorData.available = true;
 
  // update status led
  digitalWrite(DPIN_SENSOR_LED, check_status()); 
  
}

//------------------------------------------------------------------------------

};

// rfm12b radio
RFM12B radio;
char buffer[BUFFER_SIZE];
long lastPeriod = -1;

// dallas onewire configuration
