DIGITALESAVANZADOS
Dependencies: mbed Servo HC-SR04 TextLCD max6675
Revision 0:834b339f5f94, committed 2020-06-09
- Comitter:
- juanespitiarobotica
- Date:
- Tue Jun 09 23:50:25 2020 +0000
- Commit message:
- proyectodertos
Changed in this revision
diff -r 000000000000 -r 834b339f5f94 HC-SR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HC-SR04.lib Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/Nestordp/code/HC-SR04/#be89035b2c42
diff -r 000000000000 -r 834b339f5f94 Servo.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/matsu/code/Servo/#80a784fc179c
diff -r 000000000000 -r 834b339f5f94 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/KRAI-ITB-2019/code/TextLCD/#95892122f5d0
diff -r 000000000000 -r 834b339f5f94 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,86 @@ +#include "mbed.h" +#include "HCSR04.h" +#include "rtos.h" +#include "Servo.h" +#include "max6675.h" +#include "TextLCD.h" + +HCSR04 ultrasonido(PTA7,PTA6); +Servo servomotor(PTA13); +I2C i2c_lcd(D7,D6); +TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); +max6675 sensor(D12,D13,D5); +Serial pc(USBTX,USBRX); +Thread thread; +Thread thread1; +Thread thread2; +Thread thread3; + +void pantallalcd(){ + lcd.setMode(TextLCD::DispOn); + lcd.setBacklight(TextLCD::LightOn); + lcd.setCursor(TextLCD::CurOff_BlkOff); + } + +void temp_hora() +{ + set_time(1256729737); + int cf = 0; + while (1) { + time_t seconds = time(NULL); + float temp = sensor.gettemp(cf); + printf("%d", seconds); + printf("Fecha= %s", ctime(&seconds)); + + char buffer[32]; + strftime(buffer, 32, "%H:%M:%S ", localtime(&seconds)); + printf("%s", buffer); + + 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); + } +} + +void servo() +{ + + servomotor.calibrate(0.001, 180); + + while(1) { + for(int i=0; i<100; i++) { + servomotor = i*0.01; + printf("%d",i); + Thread::wait(100); + } + for(int i=100; i>0; i--) { + servomotor = i*0.01; + printf("%d",i); + Thread::wait(100); + } + } +} + +void ultra() +{ + while(1) { + float distancia=ultrasonido.getCm(); + lcd.locate(0,1); + lcd.printf("dist:%2.f cm\n",distancia); + Thread::wait(1000); + } +} + + + +int main() +{ + + thread.start((ultra)); + thread1.start ((servo)); + thread2.start ((temp_hora)); + thread3.start ((pantallalcd)); + +} \ No newline at end of file
diff -r 000000000000 -r 834b339f5f94 max6675.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/max6675.lib Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/star297/code/max6675/#74731b8476a0
diff -r 000000000000 -r 834b339f5f94 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#c9e63f14085f5751ff5ead79a7c0382d50a813a2
diff -r 000000000000 -r 834b339f5f94 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 09 23:50:25 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file