prueba1

Dependencies:   mbed motoresDC TextLCD SLCD

Files at this revision

API Documentation at this revision

Comitter:
20172573063
Date:
Tue Jun 23 23:19:20 2020 +0000
Parent:
0:465ff75162d5
Commit message:
pruebamotor;

Changed in this revision

SLCD.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.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	Tue Jun 23 23:19:20 2020 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Tue Jun 23 23:19:20 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/KRAI-ITB-2019/code/TextLCD/#95892122f5d0
--- a/main.cpp	Mon Jun 22 21:29:43 2020 +0000
+++ b/main.cpp	Tue Jun 23 23:19:20 2020 +0000
@@ -1,16 +1,50 @@
 #include "mbed.h"
 #include "rtos.h"
 #include "motoresDC.h"
+#include "TextLCD.h"
+#include "SLCD.h"
 
 
+InterruptIn botoncito(D12);
+InterruptIn botonsote(D13);
 MotoresDC carro(D8,D10, D11, D9, D12, D13);
+I2C i2c_lcd(D7,D6);
+TextLCD_I2C lcd(&i2c_lcd, 0x4E,  TextLCD::LCD16x2, TextLCD::HD44780);
+Serial pc(USBTX,USBRX);
 
-int pulso=0,num;
+int pulso=0,pulso1=0,num;
 
 Thread thread;
 Thread thread1;
 Thread thread2;
+Thread thread3;
+Thread thread4;
 
+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(1591802062-18000);
+    while (1) {
+        time_t seconds = time(NULL);
+        char buffer[32];
+        strftime(buffer, 32, "%H:%M:%S   ", localtime(&seconds));
+        lcd.locate(0,1);
+        lcd.printf("%s", buffer);
+        Thread::wait(1000);
+    }
+}
+void boton1()
+{
+    pulso=!pulso;
+}
 void motor_ascend()
 {
     while(1) {
@@ -29,7 +63,7 @@
                     carro.conducir(1);
                     break;
                 case '5':
-                    
+
                     NVIC_SystemReset ();
                     break;
             }
@@ -89,14 +123,22 @@
         }
     }
 }
-    int main() {
-        
-        thread.start (cambio);
-        thread1.set_priority (osPriorityNormal1);
-        thread1.start(motor_ascend);
-        thread2.set_priority (osPriorityNormal1);
-        thread2.start(motor_descend);
+int main()
+{
+
+    thread.start (cambio);
+    thread1.set_priority (osPriorityNormal1);
+    thread1.start(motor_ascend);
+    thread2.set_priority (osPriorityNormal1);
+    thread2.start(motor_descend);
+    thread3.start ((temp_hora));
+    thread3.set_priority (osPriorityNormal2);
+    thread4.start((pantallalcd));
+    thread.join();
+    botoncito.mode(PullUp);
+    botoncito.fall(&boton1);
 
 
-    }
-    
\ No newline at end of file
+
+
+}