Paul Backhouse / Mbed 2 deprecated cylon

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
paulo
Date:
Wed Jun 13 20:02:28 2012 +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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jun 13 20:02:28 2012 +0000
@@ -0,0 +1,25 @@
+//A simple test program to makes LEDs cycle left to right and then right to left.
+
+#include "mbed.h"
+
+PwmOut ledarray[4] = { LED1, LED2, LED3, LED4 };
+
+int main() {
+    bool forward = true;
+    int position = 0;
+    
+    while (1) {
+        if (position == 0) forward = true;
+        else if (position == 3) forward = false;
+        
+        if (forward) position++;
+        else position--;
+        
+        for (int i=0;i<4;i++) {
+            if (i==position) ledarray[i] = 1.0;
+            else if ((i==position-1) || (i==position+1)) ledarray[i] = 0.2;
+            else ledarray[i] = 0.0;
+        }
+        wait(0.2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jun 13 20:02:28 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479