Test Lib for NeoPixels

Dependencies:   NeoStrip mbed

Files at this revision

API Documentation at this revision

Comitter:
jdawkins
Date:
Thu Jul 26 12:41:47 2018 +0000
Commit message:
NeoPixel Test

Changed in this revision

NeoStrip.lib Show annotated file Show diff for this revision Revisions of this file
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 767ec3100da1 NeoStrip.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NeoStrip.lib	Thu Jul 26 12:41:47 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/aswild/code/NeoStrip/#f531a2be180d
diff -r 000000000000 -r 767ec3100da1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 26 12:41:47 2018 +0000
@@ -0,0 +1,75 @@
+#include "mbed.h"
+#include "NeoStrip.h"
+
+#define RED 0xFF0000
+#define ORANGE 0xFF8000
+#define YELLOW 0xFFFF00
+#define GREEN 0x00FF00
+#define CYAN 0x00FFFF
+#define BLUE 0x0000FF
+#define PURPLE 0x7F00FF
+#define WHITE 0xFFFFFF
+
+DigitalOut myled(LED1);
+NeoStrip leds(p30,3);
+int color_mtx[28][3];
+int N;
+
+int red,orange,yellow,green,blue,violet,white;
+
+
+int main() {
+    
+  //  red = (255 << 0 << 0);
+   // orange = 
+    N = 28;
+    leds.setBrightness(1.0);
+    myled = 1;
+    while(1) {
+        myled = !myled;
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,RED);   
+        }        
+        leds.write();
+        wait(2);
+        myled = !myled;
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,ORANGE);   
+        }
+        leds.write();
+        wait(2);
+        myled = !myled;        
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,YELLOW);   
+        }
+        leds.write();
+        wait(2);
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,GREEN);   
+        }        
+        leds.write();
+        wait(2);
+        myled = !myled;
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,CYAN);   
+        }
+        leds.write();
+        wait(2);
+        myled = !myled;        
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,BLUE);   
+        }
+        leds.write();
+        wait(2); 
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,PURPLE);   
+        }
+        leds.write();
+        wait(2); 
+        for (int i=0;i<N;i++){
+            leds.setPixel(i,WHITE);   
+        }
+        leds.write();
+        wait(2);                   
+    }
+}
diff -r 000000000000 -r 767ec3100da1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 26 12:41:47 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/f9eeca106725
\ No newline at end of file