cylon style LED display

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Thu Jan 31 19:24:41 2013 +0000
Child:
1:e28b08062150
Commit message:
ver 1.1

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jan 31 19:24:41 2013 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+// Cylon style LED scanner
+BusOut led_state(LED1, LED2, LED3, LED4);
+
+int main() {
+    int i = 0;
+    // initinal LED state
+    led_state = 0x1;
+    while (1) {
+        // loop through all states
+        for (i=0; i<6; i++) {
+            if (i<3)
+                // shift left 1 bit until high LED set
+                led_state = led_state << 1;
+            else
+                // then reverse and shift back to right 1 bit
+                led_state = led_state >> 1;
+            // time delay .1s to slow down display
+            wait(0.1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jan 31 19:24:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/74b8d43b5817
\ No newline at end of file