LED Pattern s

Dependencies:   mbed

Revision:
0:a8f171f6873d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 03 14:58:31 2016 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+/*
+jont@ninelocks.com
+Led Light Chaser for Schools demonstration
+
+*/
+//replace the next line with the output from the designer program
+char  pattern[] = { 0x01,0x02,0x04,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x04,0x02,0x01,0x02,0x04,0x05};
+
+//group LEDS as a unit
+BusOut myleds(LED1, LED2, LED3, LED4);
+
+//writes bytes to the display  
+void display_pattern(char *testdata){
+    //this finds how many elements in the array
+    int arraysize = sizeof(pattern)/sizeof(pattern[0]);
+    for(int idx = 0; idx < arraysize; idx++) {
+        myleds = testdata[idx];   
+        wait(0.2);   
+    }
+}
+ 
+int main() {
+    while(1) {
+        display_pattern(pattern); 
+        wait(0.5);             
+    }
+}