![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Prueba 7 seg mbed
Dependencies: mbed Servo HC-SR04 TextLCD max6675 SLCD
Diff: main.cpp
- Revision:
- 1:0371f6d48091
- Parent:
- 0:834b339f5f94
--- a/main.cpp Tue Jun 09 23:50:25 2020 +0000 +++ b/main.cpp Wed Jun 10 00:25:16 2020 +0000 @@ -5,6 +5,9 @@ #include "max6675.h" #include "TextLCD.h" +#include "SLCD.h" + + HCSR04 ultrasonido(PTA7,PTA6); Servo servomotor(PTA13); I2C i2c_lcd(D7,D6); @@ -15,13 +18,18 @@ Thread thread1; Thread thread2; Thread thread3; +Thread thread4; -void pantallalcd(){ +DigitalOut gpo(D0); +SLCD slcd; + +void pantallalcd() +{ lcd.setMode(TextLCD::DispOn); lcd.setBacklight(TextLCD::LightOn); lcd.setCursor(TextLCD::CurOff_BlkOff); - } - +} + void temp_hora() { set_time(1256729737); @@ -39,7 +47,7 @@ printf("%4.2f%cF \n\033[2K\033[1A",temp,176); lcd.locate(0,0); lcd.printf("temp:%1.2f\n",temp); - + Thread::wait(1000); } } @@ -71,16 +79,25 @@ lcd.printf("dist:%2.f cm\n",distancia); Thread::wait(1000); } -} +} +void seg() +{ + while (true) { + float distancia=ultrasonido.getCm(); + slcd.printf("%1.3f",distancia); + Thread::wait(1000); + } +} - int main() { - + + thread.start((ultra)); thread1.start ((servo)); thread2.start ((temp_hora)); thread3.start ((pantallalcd)); + thread4.start ((seg)); } \ No newline at end of file