Gerardo Carmona
/
08_Leds_Intermitentes
Intermittent Leds, depends of the value of an analog pin
Diff: main.cpp
- Revision:
- 0:c3e16ba86b4d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 09 21:28:09 2013 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +PwmOut rled(LED3); +PwmOut bled(LED1); +AnalogIn pot(A0); + +float pot_time; + +int main() { + +rled = 1; +bled = 1; + + while(1) { + pot_time = (pot * .450) + 0.050; + rled = 1; + bled = 0; + wait(pot_time); + rled = 0; + bled = 1; + wait(pot_time); + } +}