GY-30 for L053R8.

Dependencies:   BH1750 mbed

Committer:
sp036239
Date:
Thu Sep 14 01:22:08 2017 +0000
Revision:
0:765a67fb3724
Nucleo_L053R8_GY30

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sp036239 0:765a67fb3724 1 #include "mbed.h"
sp036239 0:765a67fb3724 2 #include "BH1750.h"
sp036239 0:765a67fb3724 3
sp036239 0:765a67fb3724 4
sp036239 0:765a67fb3724 5 DigitalOut myled(LED1);
sp036239 0:765a67fb3724 6 BH1750 myGY30(D14,D15);
sp036239 0:765a67fb3724 7 Serial pc(SERIAL_TX, SERIAL_RX);
sp036239 0:765a67fb3724 8
sp036239 0:765a67fb3724 9 int main() {
sp036239 0:765a67fb3724 10 myGY30.init();
sp036239 0:765a67fb3724 11 if(myGY30.getStatus()==0){
sp036239 0:765a67fb3724 12 pc.printf("GY-30 initialized...\r\n");
sp036239 0:765a67fb3724 13 while(1) {
sp036239 0:765a67fb3724 14 myled = !myled;
sp036239 0:765a67fb3724 15 pc.printf("%8.5f\r\n",myGY30.readIntesity());
sp036239 0:765a67fb3724 16 wait(0.2); // 200 ms
sp036239 0:765a67fb3724 17 }
sp036239 0:765a67fb3724 18 }else{
sp036239 0:765a67fb3724 19 myGY30.init();
sp036239 0:765a67fb3724 20 }
sp036239 0:765a67fb3724 21 }