A variant of the hello world LED program, which fades the LEDs in knight rider style (back and forth).

Dependencies:   mbed

Revision:
0:6cd0cbc7e4f9
--- /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;
+    }
+}