![](/media/cache/profiles/3b56beb4fb3143ab7f05335134909435.50x50_q85.jpg)
Variation - reads external variable resistor in voltages divider network on pin 18. Transition time defined.
Diff: main.cpp
- Revision:
- 2:81628a105aa0
- Parent:
- 1:35dabcdf9c02
diff -r 35dabcdf9c02 -r 81628a105aa0 main.cpp --- a/main.cpp Mon Dec 16 10:55:24 2013 +0000 +++ b/main.cpp Fri Mar 07 07:50:19 2014 +0000 @@ -3,9 +3,12 @@ PwmOut r (p23); PwmOut g (p24); PwmOut b (p25); + AnalogIn rP (p19); AnalogIn gP (p20); +AnalogIn bP (p18); +float t = .001; //change time between new readings int main() { @@ -15,12 +18,11 @@ while(1) { - r = rP; - g = gP; + r = rP; //read onboard POT + g = gP; //read onboard POT + b = bP; //read external variable resistive element in votage divider network - b = 0.5; - - wait (0.01); + wait (t); //change in i/o declarations } }