updated codes lads

Dependencies:   C12832 Servo mbed-rtos mbed

Fork of rtos_basic_team by WIT_EmbOS_Gr1

Committer:
Ali_taher
Date:
Mon Jan 19 20:41:15 2015 +0000
Revision:
8:507111cc659c
Parent:
7:c8e192e2c80c
Child:
9:f60eeadabcb0
display the sonar values values in the lcd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 1:491820ee784d 1 #include "mbed.h"
emilmont 1:491820ee784d 2 #include "rtos.h"
PaulF 7:c8e192e2c80c 3 #include "Servo.h"
Ali_taher 8:507111cc659c 4 #include "C12832.h"
PaulF 7:c8e192e2c80c 5 Servo s1(p21);
PaulF 7:c8e192e2c80c 6 Servo s2(p22);
emilmont 1:491820ee784d 7
PaulF 7:c8e192e2c80c 8 AnalogIn p1(p17);
PaulF 7:c8e192e2c80c 9 AnalogIn p2(p20);
Ali_taher 8:507111cc659c 10 C12832 lcd(p5, p7, p6, p8, p11);// lcd is an object from class c12832 initialised by p5,p7....
PaulF 7:c8e192e2c80c 11
PaulF 7:c8e192e2c80c 12 void p2_thread(void const *args) {
emilmont 1:491820ee784d 13 while (true) {
Ali_taher 8:507111cc659c 14 s2 = p1*5;
Ali_taher 8:507111cc659c 15 lcd.cls(); // clear the display
Ali_taher 8:507111cc659c 16 lcd.locate(0,3);// the location where you want your charater to be displayed
Ali_taher 8:507111cc659c 17 lcd.printf("Thread one = %f\n", (float)p1*5);
Ali_taher 8:507111cc659c 18 Thread::wait(1500);
emilmont 1:491820ee784d 19 }
emilmont 1:491820ee784d 20 }
emilmont 1:491820ee784d 21
emilmont 1:491820ee784d 22 int main() {
Ali_taher 8:507111cc659c 23 Thread thread(p2_thread);
emilmont 1:491820ee784d 24 while (true) {
Ali_taher 8:507111cc659c 25 lcd.cls(); // clear the display
Ali_taher 8:507111cc659c 26 lcd.locate(0,15); // the location where you want your charater to be displayed
Ali_taher 8:507111cc659c 27 lcd.printf("Thread two = %f\n", (float)p2*5);
PaulF 7:c8e192e2c80c 28 s1 = p1*5;
Ali_taher 8:507111cc659c 29 Thread::wait(1000);
emilmont 1:491820ee784d 30 }
emilmont 1:491820ee784d 31 }