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

Files at this revision

API Documentation at this revision

Comitter:
Soldier7
Date:
Thu Apr 23 11:00:40 2015 +0000
Parent:
23:f098ffcd192a
Commit message:
This is the working one after the merge.

Changed in this revision

RangeFinder.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/RangeFinder.lib	Thu Apr 23 10:50:12 2015 +0000
+++ b/RangeFinder.lib	Thu Apr 23 11:00:40 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/NickRyder/code/RangeFinder/#05c9036328ee
+http://mbed.org/users/NickRyder/code/RangeFinder/#cf496fb70317
--- a/main.cpp	Thu Apr 23 10:50:12 2015 +0000
+++ b/main.cpp	Thu Apr 23 11:00:40 2015 +0000
@@ -6,15 +6,13 @@
 
 Servo tiltServo(p24);
 Servo panServo(p25);
+Servo vertServo(p23);
 Serial pc(USBTX, USBRX);
-Servo vertServo(p23);
 Mutex mutexIn;// protect global variables
 Mutex mutexOut;// protect global variables
 Mutex mutex_sonar;
-AnalogIn sonar(p19); // temporary changed to potmeter
-AnalogIn corVert(p20); // temporary changed to potmeter
-Mutex mutexIn;
-Mutex mutexOut;
+AnalogIn sonar(p17); // correct is p17. TEMPORARY changed to potmeter p19
+//AnalogIn corVert(p20); // TO REMOVE. Temporary changed to potmeter
 
 // Global variables
 float corHoriz = 0.5; // horizontal variable arrives from OpenCV
@@ -38,7 +36,7 @@
 void serial_thread(void const *args)
 {
     while (true) {
-        pc.scanf("%f,%f", &corHoriz, &corVert1);// read from serial port the data // temporary Vert1
+        pc.scanf("%f,%f", &corHoriz, &corVert);// read from serial port the data // temporary Vert1
     }
 }
 
@@ -53,7 +51,7 @@
         lcd.locate(0,1);    // the location where you want your charater to be displayed
         lcd.printf("Sonar: %0.3f, OutTilt: %0.3f", sonar.read(), outTilt);
         lcd.locate(0,9);    // the location where you want your charater to be displayed
-        lcd.printf("Vert: %0.3f, OutVert: %0.3f", corVert.read(), outVert);
+        lcd.printf("Vert: %0.3f, OutVert: %0.3f", corVert, outVert);
         Thread::wait(250);
     }
 }