jlñkjfasña
Dependencies: mbed TextLCD max6675
main.cpp@0:9f27b8759b12, 2021-12-03 (annotated)
- Committer:
- juanespitiarobotica
- Date:
- Fri Dec 03 12:03:54 2021 +0000
- Revision:
- 0:9f27b8759b12
jbljk
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
juanespitiarobotica | 0:9f27b8759b12 | 1 | #include "mbed.h" |
juanespitiarobotica | 0:9f27b8759b12 | 2 | #include "max6675.h" |
juanespitiarobotica | 0:9f27b8759b12 | 3 | #include "rtos.h" |
juanespitiarobotica | 0:9f27b8759b12 | 4 | #include "TextLCD.h" |
juanespitiarobotica | 0:9f27b8759b12 | 5 | |
juanespitiarobotica | 0:9f27b8759b12 | 6 | I2C i2c_lcd(D7,D6); |
juanespitiarobotica | 0:9f27b8759b12 | 7 | TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); |
juanespitiarobotica | 0:9f27b8759b12 | 8 | max6675 sensor(D12,D13,D5); |
juanespitiarobotica | 0:9f27b8759b12 | 9 | Serial pc(USBTX,USBRX); |
juanespitiarobotica | 0:9f27b8759b12 | 10 | Thread thread; |
juanespitiarobotica | 0:9f27b8759b12 | 11 | |
juanespitiarobotica | 0:9f27b8759b12 | 12 | Thread thread2; |
juanespitiarobotica | 0:9f27b8759b12 | 13 | Thread thread3; |
juanespitiarobotica | 0:9f27b8759b12 | 14 | |
juanespitiarobotica | 0:9f27b8759b12 | 15 | |
juanespitiarobotica | 0:9f27b8759b12 | 16 | void pantallalcd() |
juanespitiarobotica | 0:9f27b8759b12 | 17 | { |
juanespitiarobotica | 0:9f27b8759b12 | 18 | lcd.setMode(TextLCD::DispOn); |
juanespitiarobotica | 0:9f27b8759b12 | 19 | lcd.setBacklight(TextLCD::LightOn); |
juanespitiarobotica | 0:9f27b8759b12 | 20 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
juanespitiarobotica | 0:9f27b8759b12 | 21 | } |
juanespitiarobotica | 0:9f27b8759b12 | 22 | |
juanespitiarobotica | 0:9f27b8759b12 | 23 | void temp_hora() |
juanespitiarobotica | 0:9f27b8759b12 | 24 | { |
juanespitiarobotica | 0:9f27b8759b12 | 25 | int cf = 1; |
juanespitiarobotica | 0:9f27b8759b12 | 26 | while (1) { |
juanespitiarobotica | 0:9f27b8759b12 | 27 | |
juanespitiarobotica | 0:9f27b8759b12 | 28 | float temp = sensor.gettemp(cf); |
juanespitiarobotica | 0:9f27b8759b12 | 29 | lcd.locate(0,0); |
juanespitiarobotica | 0:9f27b8759b12 | 30 | lcd.printf("temp:%1.2f",temp); |
juanespitiarobotica | 0:9f27b8759b12 | 31 | Thread::wait(1000); |
juanespitiarobotica | 0:9f27b8759b12 | 32 | } |
juanespitiarobotica | 0:9f27b8759b12 | 33 | } |
juanespitiarobotica | 0:9f27b8759b12 | 34 | |
juanespitiarobotica | 0:9f27b8759b12 | 35 | |
juanespitiarobotica | 0:9f27b8759b12 | 36 | int main() |
juanespitiarobotica | 0:9f27b8759b12 | 37 | { |
juanespitiarobotica | 0:9f27b8759b12 | 38 | thread2.start ((temp_hora)); |
juanespitiarobotica | 0:9f27b8759b12 | 39 | thread3.start((pantallalcd)); |
juanespitiarobotica | 0:9f27b8759b12 | 40 | thread.join(); |
juanespitiarobotica | 0:9f27b8759b12 | 41 | |
juanespitiarobotica | 0:9f27b8759b12 | 42 | } |