Wei-Ting Lin
/
Nucleo_BH1750
GY-30 for L053R8.
Revision 0:765a67fb3724, committed 2017-09-14
- Comitter:
- sp036239
- Date:
- Thu Sep 14 01:22:08 2017 +0000
- Commit message:
- Nucleo_L053R8_GY30
Changed in this revision
diff -r 000000000000 -r 765a67fb3724 BH1750.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BH1750.lib Thu Sep 14 01:22:08 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/vrabec/code/BH1750/#58ee8a917618
diff -r 000000000000 -r 765a67fb3724 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 14 01:22:08 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "BH1750.h" + + +DigitalOut myled(LED1); +BH1750 myGY30(D14,D15); +Serial pc(SERIAL_TX, SERIAL_RX); + +int main() { + myGY30.init(); + if(myGY30.getStatus()==0){ + pc.printf("GY-30 initialized...\r\n"); + while(1) { + myled = !myled; + pc.printf("%8.5f\r\n",myGY30.readIntesity()); + wait(0.2); // 200 ms + } + }else{ + myGY30.init(); + } +}
diff -r 000000000000 -r 765a67fb3724 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 14 01:22:08 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec \ No newline at end of file