     Serial.println(xbee_command, DEC);
 
     //debugging
-    xbee_command = XBEE_COMMAND_FORWARD;
+    //xbee_command = XBEE_COMMAND_FORWARD;
+    if(xbee_command == -1)
+    {
+      Serial.println("No data received");
+      xbee_command = XBEE_COMMAND_STOP;
+    }
+    else
+    {
+      xbee_command -= 48;
+    }
     
     switch(xbee_command)
     {

#define XBEE_COMMAND_TURN_RIGHT     2

#define FULL_SPEED                  255
#define TURN_SPEED                  125

#define LEFT_MOTORS                 0
#define RIGHT_MOTORS                1

void loop() {
  // put your main code here, to run repeatedly:
    unsigned int i;
    char xbee_command;

    delay(50);    // TODO: Replace this with something more deterministic, perhaps based on a timer.

    // read xbee data and update motor states
    xbee_command = xbee.read();
