Display the sonar sensor values in the LCD
Dependencies: C12832 Servo mbed-rtos mbed
Fork of rtos_basic by
Revision 8:507111cc659c, committed 2015-01-19
- Comitter:
- Ali_taher
- Date:
- Mon Jan 19 20:41:15 2015 +0000
- Parent:
- 7:c8e192e2c80c
- Commit message:
- display the sonar values values in the lcd
Changed in this revision
C12832.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 |
diff -r c8e192e2c80c -r 507111cc659c C12832.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Mon Jan 19 20:41:15 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/chris/code/C12832/#7de323fa46fe
diff -r c8e192e2c80c -r 507111cc659c main.cpp --- a/main.cpp Mon Jan 19 13:58:04 2015 +0000 +++ b/main.cpp Mon Jan 19 20:41:15 2015 +0000 @@ -1,25 +1,31 @@ #include "mbed.h" #include "rtos.h" #include "Servo.h" +#include "C12832.h" Servo s1(p21); Servo s2(p22); AnalogIn p1(p17); AnalogIn p2(p20); - +C12832 lcd(p5, p7, p6, p8, p11);// lcd is an object from class c12832 initialised by p5,p7.... void p2_thread(void const *args) { while (true) { - s2 = p1*5; - Thread::wait(1000); + s2 = p1*5; + lcd.cls(); // clear the display + lcd.locate(0,3);// the location where you want your charater to be displayed + lcd.printf("Thread one = %f\n", (float)p1*5); + Thread::wait(1500); } } int main() { - Thread thread(p2_thread); - + Thread thread(p2_thread); while (true) { + lcd.cls(); // clear the display + lcd.locate(0,15); // the location where you want your charater to be displayed + lcd.printf("Thread two = %f\n", (float)p2*5); s1 = p1*5; - Thread::wait(500); + Thread::wait(1000); } }