w mx
/
sensors_2
sr501+BH1750+mq
Fork of sensors by
Diff: example.cpp
- Revision:
- 1:1197997ae0ea
- Child:
- 2:cd0ea77c7d66
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example.cpp Wed Sep 12 15:51:26 2018 +0000 @@ -0,0 +1,35 @@ +#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); + } +} \ No newline at end of file