 {
    if (XBee.available())
     { // If data comes in from XBee, send it out to serial monitor
-    
     // get the new byte:
+    String inputString1 = "";         // a string to hold incoming data
     char inChar = (char)XBee.read(); 
     // add it to the inputString:
-    inputString += inChar;
+    inputString1 += inChar;
     while (inChar != ',')
     {
       inChar = (char)XBee.read(); 
       // add it to the inputString:
-      inputString += inChar;
+      inputString1 += inChar;
     }
-    char floatbuf[32]; 
-    inputString.toCharArray(floatbuf, sizeof(floatbuf));
-    angle = atof(floatbuf);
+    char floatbuf1[32]; 
+    inputString1.toCharArray(floatbuf1, 32*sizeof(char));
+    angle = atof(floatbuf1);
     
-    inputString = "";
+    
+    
+    String inputString2 = "";         // a string to hold incoming data
     // get the new byte:
     inChar = (char)XBee.read(); 
     // add it to the inputString:
-    inputString += inChar;
+    inputString2 += inChar;
     while (inChar != '\n')
     {
       inChar = (char)XBee.read(); 
       // add it to the inputString:
-      inputString += inChar;
+      inputString2 += inChar;
     }
 
-    inputString.toCharArray(floatbuf, sizeof(floatbuf));
-    distance = atof(floatbuf);
+    char floatbuf2[32]; 
+    inputString2.toCharArray(floatbuf2, 32*sizeof(char));
+    distance = atof(floatbuf2);
 
       Serial.print("angle:");
       Serial.println(angle);



int count = 0;
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)

// The setup() method runs once, when the sketch starts
void setup()   {                
  Serial.begin(9600);
  Serial.println(freeRam());
  XBee.begin(9600);
  
  // turn on backlight
