w mx
/
sensors_2
sr501+BH1750+mq
Fork of sensors by
example.cpp
- Committer:
- xmwmx
- Date:
- 2018-09-12
- Revision:
- 1:1197997ae0ea
- Child:
- 2:cd0ea77c7d66
File content as of revision 1:1197997ae0ea:
#include "sensors.h" #include "mbed.h" Serial usb2pc(PA_2, PA_3, 9600); DigitalOut myled(PC_13); int main() { usb2pc.printf("starting\r\n"); sr501 x(PB_1); BH1750 y(PB_7,PB_6); while(1) { /* if(x.operator ==(true)) { usb2pc.printf("get\r\n"); while(x.read()){usb2pc.printf("aaaaaaaaaaaaa\r\n");wait(0.1);myled=1;} x.reset(); } else { usb2pc.printf("no\r\n"); } wait(0.1); */ float light=y.getlightdata(); usb2pc.printf("Light intensity: %.4f Lux\r\n",light); } }