Code for Sprint 2
Dependencies: C12832 mbed rtos RangeFinder
Diff: main.cpp
- Revision:
- 1:28ea653772dc
- Parent:
- 0:5edc27224a37
- Child:
- 2:b109a4eb9b0d
diff -r 5edc27224a37 -r 28ea653772dc main.cpp --- a/main.cpp Wed Feb 25 17:33:41 2015 +0000 +++ b/main.cpp Thu Feb 26 17:31:40 2015 +0000 @@ -9,12 +9,12 @@ Mutex mutexOut; // Globel variables -float cordinates[3]; -float corHoriz; -float corVertic; -float corDeep; -float outVert; -float outHoriz; +char cordinates[3]; +char corHoriz; +char corVertic; +//float corDeep; +//float outVert; +//float outHoriz; C12832 lcd(p5, p7, p6, p8, p11);// lcd is an object from class c12832 initialised by p5,p7.... /* Thread Serial 1 - handles the output data from the control thread, and pass to the servo. @@ -22,10 +22,11 @@ void serial_thread(void const *args) { while (true) { mutexIn.lock(); -// cordinates = pc.putc(pc.getc()); + pc.gets(cordinates,2); +// cordinates = pc.putc(pc.getc()); corHoriz = cordinates[0]; corVertic = cordinates[1]; - corDeep = cordinates[2]; +// corDeep = cordinates[2]; mutexIn.unlock(); Thread::wait(200); } @@ -40,7 +41,7 @@ // 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: %f, Vert: %f, Deep: %f", corHoriz, corVertic, corDeep); + lcd.printf("Hor: %c, Vert: %c, ", corHoriz, corVertic ); mutexIn.unlock(); mutexOut.unlock(); Thread::wait(25);