using ST Nucleo F091RC on board LED to measure light intensity.

Dependencies:   mbed

main.cpp

Committer:
shaoziyang
Date:
2015-01-30
Revision:
0:4f9c5c2ed55e

File content as of revision 0:4f9c5c2ed55e:

#include "mbed.h"

Serial pc(USBTX,USBRX);

int main() {

  DigitalOut myled(LED1);

  myled = 0;

  while(1) {

    DigitalOut myled(LED1);
    myled = 1;
    wait(0.495);
    myled = 0;
    wait(0.005);

    AnalogIn Light(LED1);
    
    pc.printf("%d\r\n", Light.read_u16()>>4);

  }
}