That would definitely work for me. I unfortunately can't get it to work. I know my LED order is actually GRBW, and I've adjusted the length to 21 (the number of leds I have), but I can't get it to crunch. Right now it's just blinking one red pixel every couple of seconds.
The sequence should look like this.
#include <Adafruit_NeoPixel.h>
//IMPORTANT: Update the pin and length to match your LED strip!
#define PIN 7
#define LENGTH 21
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LENGTH, PIN, NEO_GRBW + NEO_KHZ800);
int pixels = 7;
int frames = 7;
int fps = 3;
//This data array is a R, G, B values in sequence. The pixels from the first frame are first, followed by the next frame, etc..
//We're storing this in PROGMEM (see note below) to save space in RAM which is normally more constrained
const byte data[] PROGMEM = {0,0,0,0,0,0,0,0,0,251,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,255,0,0,255,170,0,251,255,0,0,0,0,251,255,0,255,170,0,255,0,0,255,255,255,255,0,0,255,170,0,251,255,0,0,0,0,251,255,0,255,170,0,255,0,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,255,0,0,0,0,0,0,0,0,0,0};
void setup() {
strip.begin();
strip.show();
}
int currentFrame = 0;
void loop() {
for (int i=0; i<LENGTH; i++) {
int pixelIndex = i % pixels;
int index = currentFrame*pixels*3 + pixelIndex*3;
int g,r,b,w;
r = pgm_read_byte_near(data+index);
g = pgm_read_byte_near(data+index+1);
b = pgm_read_byte_near(data+index+2);
if ( r == g && g == b ) {
w = r;
r = g = b = 0;
}
else {
w = 0;
}
//Note: We're using pgm_read_byte_near to read bytes out of the data array stored in PROGMEM. These functions are not required for all configurations
//strip.setPixelColor(i,pgm_read_byte_near(data+index),pgm_read_byte_near(data+index+1),pgm_read_byte_near(data+index+2));
strip.setPixelColor( g,r,b,w );
}
strip.show();
currentFrame ++;
if (currentFrame >= frames) currentFrame = 0;
delay(1000/fps);
}
