Initial (buggy) version

Dependencies:   BLE_API mbed nRF51822

Fork of nRF51822_SimpleControls by RedBearLab

Revision:
7:0db51a3107fc
Parent:
6:074f5ec7428c
Child:
8:e275405a431d
diff -r 074f5ec7428c -r 0db51a3107fc patterns.cpp
--- a/patterns.cpp	Fri Dec 09 15:50:13 2016 +0000
+++ b/patterns.cpp	Thu Dec 15 23:25:16 2016 +0000
@@ -23,14 +23,13 @@
 }
 
 void rainbowCycle(int delay, uint8_t numLEDs, neopixel_strip_t m_strip) {
-  uint16_t i, j;
-  uint32_t ret;
+   uint16_t i, j;
+   uint32_t ret;
 
-  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
-    for(i=0; i< numLEDs; i++) {
-      //neopixel_set_color(&m_strip, i, red, green, blue);
-      //strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
-      ret = Wheel(i, m_strip, ((i * 256 / numLEDs) + j & 255));
+  for(j=0; j<256; j++) {
+    for(i=0; i<numLEDs; i++) {
+      //neopixel_set_color(&m_strip, i, Wheel((i+j) & 255));
+      ret = Wheel((i+j) & 255, m_strip, i);
     }
     neopixel_show(&m_strip);
     wait_ms(delay);
@@ -74,6 +73,30 @@
     }
 }
 
+void collegiate(int delay, uint8_t numLEDs, neopixel_strip_t m_strip) {
+
+    for (int i=0; i < numLEDs; i++) 
+        neopixel_set_color(&m_strip, i, 224,193,36);  //turn every pixel gold
+  
+    for (int i=0; i < numLEDs-1; i++) {
+        neopixel_set_color(&m_strip, i, 224,193,36);
+        neopixel_set_color(&m_strip, i+1, 0,255,0);    //turn on a green pixel and move it
+        neopixel_show(&m_strip);
+        wait_ms(delay); 
+    }
+    wait_ms(delay);
+    
+    for (int i=0; i < numLEDs; i++) 
+        neopixel_set_color(&m_strip, i, 0,255,0);  //turn every pixel green
+  
+    for (int i=0; i < numLEDs-1; i++) {
+        neopixel_set_color(&m_strip, i, 0,255,0);
+        neopixel_set_color(&m_strip, i+1, 224,193,36);    //turn on a gold pixel and move it
+        neopixel_show(&m_strip);
+        wait_ms(delay); 
+    }
+}
+
 void iceflakes(int delay, uint8_t numLEDs, neopixel_strip_t m_strip) {
     
     for (int i=0; i < numLEDs; i++) 
@@ -90,12 +113,12 @@
     for (int j=0; j<numLEDs; j++) 
         neopixel_set_color(&m_strip, j, 0,255,0);
     neopixel_show(&m_strip);
-    wait_ms(500);
+    wait_ms(1000);
     //All red
     for (int j=0; j<numLEDs; j++) 
         neopixel_set_color(&m_strip, j, 255,0,0);
     neopixel_show(&m_strip);
-    wait_ms(delay);
+    wait_ms(1000);
     //Green with a red mover
     for (int j=0; j<numLEDs; j++) 
         neopixel_set_color(&m_strip, j, 0,255,0);