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

Dependencies:   mbed

Committer:
shaoziyang
Date:
Fri Jan 30 02:22:27 2015 +0000
Revision:
0:4f9c5c2ed55e
use F091RC on board LED1 measure light intensity

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shaoziyang 0:4f9c5c2ed55e 1 #include "mbed.h"
shaoziyang 0:4f9c5c2ed55e 2
shaoziyang 0:4f9c5c2ed55e 3 Serial pc(USBTX,USBRX);
shaoziyang 0:4f9c5c2ed55e 4
shaoziyang 0:4f9c5c2ed55e 5 int main() {
shaoziyang 0:4f9c5c2ed55e 6
shaoziyang 0:4f9c5c2ed55e 7 DigitalOut myled(LED1);
shaoziyang 0:4f9c5c2ed55e 8
shaoziyang 0:4f9c5c2ed55e 9 myled = 0;
shaoziyang 0:4f9c5c2ed55e 10
shaoziyang 0:4f9c5c2ed55e 11 while(1) {
shaoziyang 0:4f9c5c2ed55e 12
shaoziyang 0:4f9c5c2ed55e 13 DigitalOut myled(LED1);
shaoziyang 0:4f9c5c2ed55e 14 myled = 1;
shaoziyang 0:4f9c5c2ed55e 15 wait(0.495);
shaoziyang 0:4f9c5c2ed55e 16 myled = 0;
shaoziyang 0:4f9c5c2ed55e 17 wait(0.005);
shaoziyang 0:4f9c5c2ed55e 18
shaoziyang 0:4f9c5c2ed55e 19 AnalogIn Light(LED1);
shaoziyang 0:4f9c5c2ed55e 20
shaoziyang 0:4f9c5c2ed55e 21 pc.printf("%d\r\n", Light.read_u16()>>4);
shaoziyang 0:4f9c5c2ed55e 22
shaoziyang 0:4f9c5c2ed55e 23 }
shaoziyang 0:4f9c5c2ed55e 24 }