w mx
/
sensors_2
sr501+BH1750+mq
Fork of sensors by
Diff: example.cpp
- Revision:
- 3:31aec950f7dc
- Parent:
- 2:cd0ea77c7d66
diff -r cd0ea77c7d66 -r 31aec950f7dc example.cpp --- a/example.cpp Thu Sep 13 05:52:55 2018 +0000 +++ b/example.cpp Fri Sep 14 10:52:15 2018 +0000 @@ -12,6 +12,7 @@ sr501 x(PB_1); BH1750 y(PB_7,PB_6); mq z(PA_7,PA_6); + dht11 w(PA_5); while(1) { @@ -33,11 +34,11 @@ float light=y.getlightdata(); usb2pc.printf("Light intensity: %.4f Lux\r\n",light); */ - + /* if(z.operator==(true)) { usb2pc.printf("mq on\r\n"); - while(!z.read()){usb2pc.printf("aaaaaaaaaaaaa\r\n");wait(0.1);myled=1;} + while(!z.read()){usb2pc.printf("%.3f\r\n",z.getairdata());wait(0.1);myled=1;} myled = 1; // LED is ON wait(0.2); // 200 ms z.reset(); @@ -48,6 +49,14 @@ myled = 0; // LED is OFF wait(1.0); // 1 sec } - + */ + ///* + if(w.getdata()) + { + usb2pc.printf("Humidity (%):%.3f\r\n",w.gethumidity()); + usb2pc.printf("Temperature (oC): %.3f\r\n",w.gettemperature()); + } + wait(2); + //*/ } } \ No newline at end of file