I have a chain of 7 ShiftBrite units that I just started playing with. I would like to have them gradually shift through a range of colors that loops seamlessly, each ShiftBrite will be a different hue and the colors move down the line as the animation progresses. (edit: I found a video of the exact effect I am looking for.) Usually I can look through other people's code and learn from there, but this is proving a bit more difficult for me to figure out.

Right now I am using a portion of code from this Spookotron project. The code is working great, and it does cycle through a hue ramp, but it cycles the entire chain of lights at the same time so that all lights are the same color. I would like to have each ShiftBrite be a unique color. Unfortunately using shift registers and LEDs are new to me so I haven't been able to figure out how to approach this.

What's the best way to approach the math behind the color cycles? Either direct help or even just pointing me to a similar project is appreciated.

Below is the code I am currently using. I've stripped it down to just the basics. It runs the hue ramp code stripped from the spookotron project, alternates a backlight, and after 30 seconds shuts itself down using a Pololu power switch.

// Use a bit more current for the blue LEDs as they aren't // anywhere near as bright as the green ones. Red is somewhere // in the middle. SB_CommandMode = B01; // Write to current control registers SB_ColorCommand[0] = 50; SB_ColorCommand[1] = 10; SB_ColorCommand[2] = 100;

For a quick test I counted from 0 to 2(pi).Then just set my colors 120 degrees out of phase (3 phase color)

for angle=0 to 6.28 * cyclesRed=1023*(sin(angle)+1)Geen=1023*(sin(angle+120)+1)Blue=1023*(sin(angle+240)+1)

Perhaps that will help you. (Hopefully my math is right, lol)The angle step size should be increased so each shiftbright won't appear to have the same color. This depends on how many shiftbrights you have.Just clock out one word at a time, the shiftbrights will send the data down the line by themselves.