Great library - very handy whilst working on this WS2801 project!
I’m needing a function to pull the R/G/B values directly out of the leds array so I can do some math on them. I’m trying to slow “grow” a chain of pixels, and although there is a “fade” function that cranks down values, I’m trying to write one that goes up.
Simple example:
leds[0]=5,5,5
leds[1]=10,10,10
I’m trying to grow the illumination from the values in leds[0] to leds[1] in a series of predetermined intervals (spec’d or calc’d; not sure which). It’s sure be handy to have a function similar to the color setting function:
leds[i].red = 50;
but where it would return the RGB value specified.
I’ve written a function to parse values from the HEX into RGB, but they write to global variables. My C-fu isn’t strong enough to write a proper function that returns the array to the calling function.
void fadecol(long fromCol, long toCol) {
int rfromCol = (fromCol >> 16) & 0xFF; //Parse out the RGB values of the FROM color
int gfromCol = (fromCol >> 8) & 0xFF;
int bfromCol = (fromCol >> 0) & 0xFF;
byte rtoCol = (toCol >> 16) & 0xFF; //Parse out the RGB values of the TO color
byte gtoCol = (toCol >> 8) & 0xFF;
byte btoCol = (toCol >> 0) & 0xFF;
Anybody mind throwing a bone my way so I can figure out a method to do this?
(ps: The C in the pixeltype.h is impressive. Much to grok, like “return *this;” Funky…)