![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
prueba1
Dependencies: mbed motoresDC TextLCD SLCD
Diff: main.cpp
- Revision:
- 1:e51f299dd462
- Parent:
- 0:465ff75162d5
--- 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 + + +}