Hendrik Lipka
/
Hello_mbed_world_fading_leds_kr
A variant of the hello world LED program, which fades the LEDs in knight rider style (back and forth).
Revision 0:6cd0cbc7e4f9, committed 2010-11-24
- Comitter:
- hlipka
- Date:
- Wed Nov 24 21:25:44 2010 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 6cd0cbc7e4f9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 24 21:25:44 2010 +0000 @@ -0,0 +1,58 @@ +//Hello mbed world fading leds knightrider-style +#include "mbed.h" + +PwmOut led_1(LED1); +PwmOut led_2(LED2); +PwmOut led_3(LED3); +PwmOut led_4(LED4); + +int main() { + // led1+ + for(float i=0;i<1.0F;i+=0.01){ + led_1 = i; + wait_ms(5); + } + while(1) { + // led1-/2+ + for(float i=0;i<1.0F;i+=0.01){ + led_2 = i; + led_1 = 1.0f-i; + wait_ms(5); + } + led_1 = 0; + // led2-/3+ + for(float i=0;i<1.0F;i+=0.01){ + led_3 = i; + led_2 = 1.0f-i; + wait_ms(5); + } + led_2 = 0; + // led3-/4+ + for(float i=0;i<1.0F;i+=0.01){ + led_4 = i; + led_3 = 1.0f-i; + wait_ms(5); + } + // led3+/4- + for(float i=0;i<1.0F;i+=0.01){ + led_3 = i; + led_4 = 1.0f-i; + wait_ms(5); + } + led_4 = 0; + // led3-/2+ + for(float i=0;i<1.0F;i+=0.01){ + led_2 = i; + led_3 = 1.0f-i; + wait_ms(5); + } + led_3 = 0; + // led1+/2- + for(float i=0;i<1.0F;i+=0.01){ + led_1 = i; + led_2 = 1.0f-i; + wait_ms(5); + } + led_2 = 0; + } +}
diff -r 000000000000 -r 6cd0cbc7e4f9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 24 21:25:44 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da