Prueba 7 seg mbed

Dependencies:   mbed Servo HC-SR04 TextLCD max6675 SLCD

Files at this revision

API Documentation at this revision

Comitter:
20172573063
Date:
Wed Jun 10 00:25:16 2020 +0000
Parent:
0:834b339f5f94
Commit message:
proyecto_prueba7seg

Changed in this revision

SLCD.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SLCD.lib	Wed Jun 10 00:25:16 2020 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
--- 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