liang brain
/
training_template2
trainning_template
main.cpp
- Committer:
- brainliang
- Date:
- 2020-12-01
- Revision:
- 6:398753e95e87
- Parent:
- 5:7534fc9248a8
File content as of revision 6:398753e95e87:
#define HIGH 1 #define LOW 0 #include "mbed.h" #include <string> typedef bool boolean; typedef std::string String; #include "sensors.h" #include "converters.h" float temp; float humi; dht11 dht11_PA_0(PA_0); Serial Serial_2(PA_2,PA_3); int main() { Serial_2.baud(9600); while (true) { 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); } } }