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:
4:70090f3b1f07
Parent:
3:3d53799c2f18
Child:
7:24d62ef1ed34
Child:
9:e5d24b7a921b
--- a/main.cpp	Sat Mar 07 22:56:18 2015 +0000
+++ b/main.cpp	Thu Mar 12 19:57:41 2015 +0000
@@ -7,13 +7,16 @@
 Serial pc(USBTX, USBRX);
 Mutex mutexIn;
 Mutex mutexOut;
+ 
+AnalogIn p1(p19);
+AnalogIn p2(p20);
 
 // Globel variables
 char cordinates[20];
 char corHoriz[20];
-char corVertic[20];
+char corVert[20];
 //float corDeep;
-//float outVert;
+float outVert;
 //float outHoriz;
 C12832 lcd(p5, p7, p6, p8, p11);// lcd is an object from class c12832 initialised by p5,p7....
 
@@ -24,15 +27,7 @@
         mutexIn.lock();
       //  pc.gets(cordinates,4);
      //   cordinates = pc.putc(pc.getc());
-         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]);
-
-        //corVertic = cordinates[1];
-//        corDeep = cordinates[2];
+         pc.scanf("%s \n %s \n ",corHoriz,corVert);// read from serial port the data
         mutexIn.unlock();
         Thread::wait(200);
     }
@@ -46,13 +41,10 @@
         mutexOut.lock();
         // 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.locate(0,10);    // the location where you want your charater to be displayed
-        lcd.printf("Ver%s", corHoriz);
+        lcd.locate(0,5);    // the location where you want your charater to be displayed
+        lcd.printf("Hor:%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 );
+        lcd.printf("Ver%s", corVert);
         mutexIn.unlock();
         mutexOut.unlock();
         Thread::wait(25);
@@ -65,7 +57,10 @@
     while (true) {
         mutexIn.lock();
         // The control code will come here
-        
+        if (corHoriz[1]=='1')
+            s1 = s1 + 0.25;
+        if (corHoriz[1]=='2')
+            s1 = s1 - 0.25;
         mutexIn.unlock();
         Thread::wait(25);
     }