![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lights up to 4 LEDs based on ambient light levels. Uses Grove Seeed Light Sensor
Fork of Seeed_Grove_Shield_Light_Sensor by
Diff: main.cpp
- Revision:
- 2:76004e9cf0cc
- Parent:
- 1:d10e08a99894
- Child:
- 3:15c1934a8316
diff -r d10e08a99894 -r 76004e9cf0cc main.cpp --- a/main.cpp Tue Jul 29 13:43:06 2014 +0000 +++ b/main.cpp Sat Aug 16 00:20:04 2014 +0000 @@ -18,16 +18,14 @@ #include "mbed.h" -AnalogIn sensor(A0); +AnalogIn sensor(A1); DigitalOut myled(LED1); -Serial pc(USBTX, USBRX); - int main() { float val; while(1) { val = sensor.read(); - printf("Sensor reading: %f - %f\r\n", val, (float)(1023-val)*10/val); + printf("Sensor reading: %2.2f - %2.2f\r\n", val, (float)(1023-val)*10/val); myled = !myled; wait(0.5); }