Junichi Katsu
/
Grove_SlidePotentiometer
GROVE - スライドボリューム サンプルプログラム
Revision 1:581972f3c1a3, committed 2013-11-30
- Comitter:
- jksoft
- Date:
- Sat Nov 30 03:39:54 2013 +0000
- Parent:
- 0:1637b9314685
- Commit message:
- Rev2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1637b9314685 -r 581972f3c1a3 main.cpp --- a/main.cpp Fri Nov 29 07:42:36 2013 +0000 +++ b/main.cpp Sat Nov 30 03:39:54 2013 +0000 @@ -1,5 +1,7 @@ #include "mbed.h" +#define GAIN 10.0 + BusOut myleds(LED1, LED2, LED3, LED4); DigitalOut ExtLed(p5); AnalogIn SlidePotentiometer(p15); @@ -9,6 +11,8 @@ float value = SlidePotentiometer; int ledbit = 0x00; + value *= GAIN; + if( value > 0.8 ) { ledbit = 0x0F; ExtLed = 1; @@ -26,6 +30,8 @@ ledbit = 0x00; ExtLed = 0; } + + myleds = ledbit; printf("Value = %f\r\n",value); wait(0.2); }