w mx
/
sensors3
sr501/BH1750/mq-2/dht11
Fork of sensors_2 by
Diff: example.cpp
- Revision:
- 4:fe1e9f9c7b33
- Parent:
- 3:31aec950f7dc
--- a/example.cpp Fri Sep 14 10:52:15 2018 +0000 +++ b/example.cpp Thu Oct 18 16:23:13 2018 +0000 @@ -13,10 +13,14 @@ BH1750 y(PB_7,PB_6); mq z(PA_7,PA_6); dht11 w(PA_5); + DS18B20 v(PC_14); + YL u(PA_1,PA_0); + BMP180 t(PB_9,PB_8); + GP2Y1010 s(PA_8,PB_0); while(1) { - /* + /*sr501 if(x.operator ==(true)) { usb2pc.printf("get\r\n"); @@ -30,11 +34,11 @@ } wait(0.1); */ - /* + /*BH1750 float light=y.getlightdata(); usb2pc.printf("Light intensity: %.4f Lux\r\n",light); */ - /* + /*mq if(z.operator==(true)) { usb2pc.printf("mq on\r\n"); @@ -50,13 +54,45 @@ wait(1.0); // 1 sec } */ - ///* + /*dht11 if(w.getdata()) { usb2pc.printf("Humidity (%):%.3f\r\n",w.gethumidity()); usb2pc.printf("Temperature (oC): %.3f\r\n",w.gettemperature()); } wait(2); - //*/ + */ + /*DS18B20 + if(v.getdata()) + { + usb2pc.printf("Temperature (oC): %.3f\r\n",v.gettemperature()); + } + wait(2); + */ + /*YL-38 + if(u.operator==(true)) + { + usb2pc.printf("YL on\r\n"); + while(!u.read()){usb2pc.printf("%.3f\r\n",u.getairdata());wait(0.1);myled=1;} + myled = 1; // LED is ON + wait(0.2); // 200 ms + u.reset(); + } + else + { + usb2pc.printf("YL off\r\n"); + myled = 0; // LED is OFF + wait(1.0); // 1 sec + } + */ + /*bmp180 + usb2pc.printf("Temperature is %.1f C\r\n", (float)t.BMP180GetTemperature()); + usb2pc.printf("Pressure is %.3f kPa\r\n", (float)t.BMP180GetPressure()/1000.0); + wait(1.0); + */ + /*GP2Y1010 + usb2pc.printf("Dust Density: %.3f \r\n",s.getairdata()) ; + wait(1.0); + */ } } \ No newline at end of file