jlkjñ
Dependencies: mbed TextLCD max6675 DHT11
main.cpp@0:21ed3e67799f, 2021-12-15 (annotated)
- Committer:
- juanespitiarobotica
- Date:
- Wed Dec 15 23:57:36 2021 +0000
- Revision:
- 0:21ed3e67799f
hjjh
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
juanespitiarobotica | 0:21ed3e67799f | 1 | #include "mbed.h" |
juanespitiarobotica | 0:21ed3e67799f | 2 | #include "max6675.h" |
juanespitiarobotica | 0:21ed3e67799f | 3 | #include "TextLCD.h" |
juanespitiarobotica | 0:21ed3e67799f | 4 | #include "DHT11.h" |
juanespitiarobotica | 0:21ed3e67799f | 5 | |
juanespitiarobotica | 0:21ed3e67799f | 6 | DigitalOut s1(D8); |
juanespitiarobotica | 0:21ed3e67799f | 7 | DigitalOut led(LED2); |
juanespitiarobotica | 0:21ed3e67799f | 8 | AnalogIn poten(A5); |
juanespitiarobotica | 0:21ed3e67799f | 9 | I2C i2c_lcd(D5,D7); |
juanespitiarobotica | 0:21ed3e67799f | 10 | DHT11 med(D6); |
juanespitiarobotica | 0:21ed3e67799f | 11 | TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); |
juanespitiarobotica | 0:21ed3e67799f | 12 | max6675 tem(D12,D13,D11); |
juanespitiarobotica | 0:21ed3e67799f | 13 | Serial pc(USBTX,USBRX); |
juanespitiarobotica | 0:21ed3e67799f | 14 | |
juanespitiarobotica | 0:21ed3e67799f | 15 | int main() |
juanespitiarobotica | 0:21ed3e67799f | 16 | { |
juanespitiarobotica | 0:21ed3e67799f | 17 | lcd.setMode(TextLCD::DispOn); |
juanespitiarobotica | 0:21ed3e67799f | 18 | lcd.setBacklight(TextLCD::LightOn); |
juanespitiarobotica | 0:21ed3e67799f | 19 | lcd.setCursor(TextLCD::CurOff_BlkOff); |
juanespitiarobotica | 0:21ed3e67799f | 20 | int tempera=med.readData(); |
juanespitiarobotica | 0:21ed3e67799f | 21 | int cf=0; |
juanespitiarobotica | 0:21ed3e67799f | 22 | while(1){ |
juanespitiarobotica | 0:21ed3e67799f | 23 | int tempera=med.readData(); |
juanespitiarobotica | 0:21ed3e67799f | 24 | float po=poten.read_u16(); |
juanespitiarobotica | 0:21ed3e67799f | 25 | float temp = tem.gettemp(cf); |
juanespitiarobotica | 0:21ed3e67799f | 26 | lcd.locate(0,0); |
juanespitiarobotica | 0:21ed3e67799f | 27 | lcd.printf("tempera:%1.2f\n",temp); |
juanespitiarobotica | 0:21ed3e67799f | 28 | printf("%1.2f\n", po); |
juanespitiarobotica | 0:21ed3e67799f | 29 | wait(0.5); |
juanespitiarobotica | 0:21ed3e67799f | 30 | |
juanespitiarobotica | 0:21ed3e67799f | 31 | } |
juanespitiarobotica | 0:21ed3e67799f | 32 | } |