Junichi Katsu
/
Grove_LightSensor
GROVE - 光センサ サンプルプログラム
Revision 1:1b7b641caea5, committed 2013-11-30
- Comitter:
- jksoft
- Date:
- Sat Nov 30 02:01:04 2013 +0000
- Parent:
- 0:9a4f94089a39
- Commit message:
- ?????????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9a4f94089a39 -r 1b7b641caea5 main.cpp --- a/main.cpp Fri Nov 29 07:34:45 2013 +0000 +++ b/main.cpp Sat Nov 30 02:01:04 2013 +0000 @@ -1,5 +1,7 @@ #include "mbed.h" +#define GAIN 1.4 + BusOut myleds(LED1, LED2, LED3, LED4); AnalogIn LightSensor(p15); @@ -8,6 +10,8 @@ float value = LightSensor; int ledbit = 0x00; + value *= GAIN; + if( value > 0.8 ) { ledbit = 0x0F; } @@ -23,6 +27,8 @@ else { ledbit = 0x00; } + + myleds = ledbit; printf("Value = %f\r\n",value); wait(0.2); }