sonar sensor is working in the version of code but the reading are not correct

Dependencies:   C12832 Pulse RangeFinder Servo mbed rtos

Fork of Team_Sprint2 by WIT_EmbOS_Gr1

Revision:
3:3d53799c2f18
Parent:
2:b109a4eb9b0d
Child:
4:70090f3b1f07
--- a/main.cpp	Thu Mar 05 17:43:10 2015 +0000
+++ b/main.cpp	Sat Mar 07 22:56:18 2015 +0000
@@ -10,8 +10,8 @@
 
 // Globel variables
 char cordinates[20];
-char corHoriz;
-char corVertic;
+char corHoriz[20];
+char corVertic[20];
 //float corDeep;
 //float outVert;
 //float outHoriz;
@@ -24,7 +24,9 @@
         mutexIn.lock();
       //  pc.gets(cordinates,4);
      //   cordinates = pc.putc(pc.getc());
-         pc.gets(cordinates,4);// read from serial port the data
+         pc.scanf("%s \n %s \n %s",cordinates,corHoriz,corVertic);// read from serial port the data
+         // look for carriage return and assign the first number of to the cordinates and then the second to corHiz 
+         
          //corHoriz=cordinates;
         // corHoriz=(cordinates[0]+cordinates[1]+cordinates[2]+cordinates[3]);
         // corVertic=(cordinates[4]+cordinates[5]+cordinates[6]+cordinates[7]);
@@ -45,7 +47,11 @@
         // Display values on the LCD screen
         lcd.cls();          // clear the display
         lcd.locate(0,3);    // the location where you want your charater to be displayed
-        lcd.printf("Hor: %s ",cordinates );
+        lcd.printf("Hor:%s",cordinates);
+        lcd.locate(0,10);    // the location where you want your charater to be displayed
+        lcd.printf("Ver%s", corHoriz);
+        lcd.locate(0,20);    // the location where you want your charater to be displayed
+        lcd.printf("Ver%s", corVertic);
        // lcd.printf("vertical: %s ",cordinates );
         mutexIn.unlock();
         mutexOut.unlock();