       }
     }
     break;
-    case CONNECTED:
+  case CONNECTED:
     // temporarily for debugging 
     // turn on the ligth to indicate
     digitalWrite(ledStatePin, HIGH);

  if(XBee.available()) {
    digitalWrite(ledSignalPin, HIGH);
    signal_time = millis();
    } else if(millis() - signal_time > 200) {
      digitalWrite(ledSignalPin, LOW);
    }

    switch(state) {
      case IDLE:
    // purely listening and then react by response
    // for now test use random
    // if(irrecv.decode(&results)) {


      digitalWrite(ledStatePin, LOW);

      if(XBee.available()) {

        delay(5);
        char packet[50];
        int len = readXBeeString(packet);

        DEBUG_PRINT("\nPacket received: ");
        DEBUG_PRINT(packet);
        DEBUG_PRINT("  Packet len: ");
        DEBUG_PRINTLN(len);

        randomDelay = random(1000);
        delay(randomDelay);

      // send back acknowledge packet
      struct XBeePacket p;

    char a[2];
    itoa(id, a, 10);
    deviceId[1] = a[0];
  } else {
    itoa(id, deviceId, 10);  
  }

  Serial.print("my devide ID: ");
  Serial.println(deviceId);  
}
