Display the sonar sensor values in the LCD

Dependencies:   C12832 Servo mbed-rtos mbed

Fork of rtos_basic by WIT_EmbOS_Gr1

main.cpp

Committer:
Ali_taher
Date:
2015-01-19
Revision:
8:507111cc659c
Parent:
7:c8e192e2c80c

File content as of revision 8:507111cc659c:

#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;
            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); 
    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(1000);
    }
}