This program uses the 4 LEDS of the mbed to produce the famous Knight Rider pattern (displayed on Kit).

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
boseji
Date:
Mon Jul 05 11:41:32 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 07e6f78069f6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jul 05 11:41:32 2010 +0000
@@ -0,0 +1,20 @@
+// Knight Riger Pattern Generator - by Boseji
+// http://m8051.blogspot.com
+#include "mbed.h"
+#define WAIT_time 0.04
+#define D() wait(WAIT_time)
+DigitalOut mled0(LED1);
+DigitalOut mled1(LED2);
+DigitalOut mled2(LED3);
+DigitalOut mled3(LED4);
+int main() {
+    while(1) {
+        mled0 = 1;D();mled1 = 1;D();mled2 = 1;D();        
+        mled3 = 1;mled0=0;D();
+        mled1 = 0;D();mled2 = 0;D();mled3 = 0;D();D();D();
+        
+        mled3 = 1;D();mled2 = 1;D();mled1 = 1;D();        
+        mled0 = 1;mled3=0;D();
+        mled2 = 0;D();mled1 = 0;D();mled0 = 0;D();D();D();
+    }
+}
diff -r 000000000000 -r 07e6f78069f6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jul 05 11:41:32 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/3944f1e2fa4f