A simple Larsen scanner using the onboard LEDs.... because there aren't enough of these already.

Files at this revision

API Documentation at this revision

Comitter:
benbitwonder
Date:
Sat Feb 27 18:47:50 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 1caccdf9730e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 27 18:47:50 2010 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+BusOut ledarray(LED1, LED2, LED3, LED4);
+
+int main(void) {
+    //A flag to indicate which direction we should rotate
+    bool flag = 0;
+    //the states of the outputs
+    char outstates = 1;
+
+    //Place the outputs in a known state
+    ledarray=1;
+    
+    //Infinite loop
+    while(1) {
+        wait(0.25);
+        if (!flag) {
+            outstates *= 2;
+            if ((outstates>>3)&&1) flag=1;
+        } else {
+            outstates /=2;
+            if (outstates==1) flag=0;
+        }
+        ledarray=outstates;
+    }
+}
+        
+    
\ No newline at end of file
diff -r 000000000000 -r 1caccdf9730e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Feb 27 18:47:50 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0