Code for Sprint 2
Dependencies: C12832 mbed rtos RangeFinder
Diff: main.cpp
- Revision:
- 2:b109a4eb9b0d
- Parent:
- 1:28ea653772dc
- Child:
- 3:3d53799c2f18
diff -r 28ea653772dc -r b109a4eb9b0d main.cpp --- a/main.cpp Thu Feb 26 17:31:40 2015 +0000 +++ b/main.cpp Thu Mar 05 17:43:10 2015 +0000 @@ -9,7 +9,7 @@ Mutex mutexOut; // Globel variables -char cordinates[3]; +char cordinates[20]; char corHoriz; char corVertic; //float corDeep; @@ -22,10 +22,14 @@ void serial_thread(void const *args) { while (true) { mutexIn.lock(); - pc.gets(cordinates,2); -// cordinates = pc.putc(pc.getc()); - corHoriz = cordinates[0]; - corVertic = cordinates[1]; + // pc.gets(cordinates,4); + // cordinates = pc.putc(pc.getc()); + pc.gets(cordinates,4);// read from serial port the data + //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]; mutexIn.unlock(); Thread::wait(200); @@ -41,7 +45,8 @@ // 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: %c, Vert: %c, ", corHoriz, corVertic ); + lcd.printf("Hor: %s ",cordinates ); + // lcd.printf("vertical: %s ",cordinates ); mutexIn.unlock(); mutexOut.unlock(); Thread::wait(25);