Alfonso Martone
/
temt6000
Using a TEMT6000 light sensor (Sparkfun BOB-08688).
Revision 0:69dfca36c935, committed 2010-03-22
- Comitter:
- alfmar
- Date:
- Mon Mar 22 22:50:36 2010 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 69dfca36c935 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 22 22:50:36 2010 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +DigitalOut led0(LED1), led25(LED2), led50(LED3), led75(LED4); + +AnalogIn temt6000(p20); +// temt6000 breakout: VCC(to VOUT=3.3V), GND(to GND), SIG(to p20) + +int main() +{ + for(;;) + { + float x = temt6000; + + // four LEDs meaning "light level" (1 to 4): + led0 = 1; + led25 = led50 = led75 = 0; + if(x>0.25) led25 = 1; + if(x>0.50) led50 = 1; + if(x>0.75) led75 = 1; + + printf("%f\r\n", x); + wait(0.25); + } +}
diff -r 000000000000 -r 69dfca36c935 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 22 22:50:36 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0