![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
trainning_template
Diff: main.cpp
- Revision:
- 6:398753e95e87
- Parent:
- 5:7534fc9248a8
diff -r 7534fc9248a8 -r 398753e95e87 main.cpp --- a/main.cpp Tue Dec 01 05:21:19 2020 +0000 +++ b/main.cpp Tue Dec 01 07:10:01 2020 +0000 @@ -7,26 +7,24 @@ #include "sensors.h" #include "converters.h" -int gasOK; -boolean item; +float temp; +float humi; +dht11 dht11_PA_0(PA_0); Serial Serial_2(PA_2,PA_3); -YL analog_PC_15(PC_15,PA_0); -DigitalOut myDigitalOutPC_13(PC_13); int main() { Serial_2.baud(9600); -item = 0; while (true) { -item = !item; -myDigitalOutPC_13.write(item); +if (dht11_PA_0.getdata()) { +temp = dht11_PA_0.gettemperature(); +humi = dht11_PA_0.gethumidity(); +Serial_2.printf("temp:%.2f\n",_p(temp)); +Serial_2.printf("humi:%.2f\n",_p(humi)); wait_ms(1000); -if (analog_PC_15==true) { -gasOK = analog_PC_15.read(); -Serial_2.printf("gas: %d\n",_p(gasOK)); } }