Similar to KITT light bar but not...I need help please

The project I am trying to complete is to have a set of shiftbrites (currently just 10) change from red to blue in sequence.

They need to all start out being RED then slowly change to BLUE but only 1 at a time as they work down the chain, and as it works down the chain the upper most LEDs will go out. Kind of hard to explain.

Basically I want to create the effect of a GAS (RED) being compressed to a liquid (BLUE) and make it look as if there is a "plunger" of some sort above it pushing it down (compressing it).

Ending at 2 LEDS showing bright BLUE with the plunger (white or black or brown..does not matter) sitting right above it.

I started with the code used for the ShiftBrite Knight Rider @ http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1217291822/27#27

The code change was easy to just get the red and blue but beyond that I'm lost.

I am new to this and have ordered 2 Arduino books as well as looking everywhere to learn.
All help greatly appreciated as this is a project for work they expect me to get done knowing I have never done this type of work before.

THANKS!

Is what I am trying to accomplish to difficult with this setup?

Is what I am trying to accomplish to difficult with this setup?

A change in the setup is not going to make it any easier. You have two choices when it comes to sequences like this.

The first one is to work out what you need to do for every step and implement it problematically. So each step in the fade sequence needs to be created by some sort of algorithm.

The second one is to work out what you need to do for every step and implement it by means of a look up table, that is to say a pre defined array that you keep reading the values out of and sending to all the light modules.

It's not one of those things some one is going to write for you, you will have to learn how to program.

I don't necessarily want any one to write it for me but I would like a little guidance on how to write the code to control each individual shiftbrite module in the chain. Do I use a variation of shiftout() to identify each shiftbrite? How can I tell the 2nd shiftbrite to turn black while at the same time be telling the 9th & 10th shiftbrites to turn blue, while the ones inbetween stay red?

I guess I just need direction on how to implement this. I am new to this, though I do have some experience programming in c++.

If you check the code examples you can see that you don't even have to worry about how to tell each ShiftBrite to be a specific color. There's an array that holds all the RGB values and there's a WriteLEDArray() function that already does everything for you, when you want to update the actual LEDs with the contents array you have in memory. All you need to do is arbitrarily write any pixels with any colors you want, and then call the WriteLEDArray() function.

Thanks for the help. I started with a basic sketch to get the colors to change how I need them. I have not simplified the code yet as I would like to get this to work exactly as needed before I try to condense the code.

Here is my code as of now ( WITHOUT LOOP() )...
Could some one guide me on adding a fade effect to the arrays I have so that the colors transition smoothly?

const int clockpin = 13; // DI
const int  enablepin = 10; // LI
const int latchpin = 9; // EI
const int datapin = 11; // CI

const int NumLEDs = 10; // Number of LEDs in chain
int fade = 64;
 
int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
int SB_GreenCommand;
int SB_BlueCommand;
 
void setup() {
 
   pinMode(datapin, OUTPUT);
   pinMode(latchpin, OUTPUT);
   pinMode(enablepin, OUTPUT);
   pinMode(clockpin, OUTPUT);
   SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0);
   digitalWrite(latchpin, LOW);
   digitalWrite(enablepin, LOW);
 
 
}
 
void SB_SendPacket() {
 
    if (SB_CommandMode == B01) {
     SB_RedCommand = 120;
     SB_GreenCommand = 100;
     SB_BlueCommand = 100;
    }
 
    SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_BlueCommand<<4 | SB_RedCommand>>6;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_RedCommand << 2 | SB_GreenCommand>>8;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_GreenCommand;
    while(!(SPSR & (1<<SPIF)));
 
}
 
void WriteLEDArray() {
 
    SB_CommandMode = B00; // Write to PWM control registers
    for (int h = 0;h<NumLEDs;h++) {
	  SB_RedCommand = LEDChannels[h][0];
	  SB_GreenCommand = LEDChannels[h][1];
	  SB_BlueCommand = LEDChannels[h][2];
	  SB_SendPacket();
    }
 
    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);
 
    SB_CommandMode = B01; // Write to current control registers
    for (int z = 0; z < NumLEDs; z++) SB_SendPacket();
    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);
 
}
//void Fade(int Steps)   //This is the start of fade code I was trying to write.
//{
//if (Steps >= 0) {
//   return 64[Steps];
// } else if (Steps <= 0) {
//  return 1023;
// }
//   else if (Steps >= 1023) {
//     return 0;
//   }

Here is the loop() section

void loop() {
 //1
   LEDChannels[0][0] = 1023;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 1023;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 1023;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 1023;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 1023;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 1023;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 1023;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 1023;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 1023;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 1023;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
  //2 
   LEDChannels[0][0] = 200;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 500;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 700;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 1023;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 1023;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 1023;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 1023;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 1023;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 900;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 900;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
 //3  
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 200;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 500;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 700;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 1023;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 1023;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 1023;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 1023;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 900;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 700;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
//4   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 200;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 500;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 700;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 900;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 900;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 800;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 700;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 00;
 
   LEDChannels[9][0] = 500;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
//5   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 200;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 500;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 700;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 700;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 700;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 500;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 300;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
   
//6   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 0;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 200;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 500;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 500;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 300;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 200;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 100;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 0;
 
   WriteLEDArray();
   delay(200);
//7   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 0;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 0;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 200;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 300;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 200;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 100;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 0;
 
   LEDChannels[9][0] = 0;
   LEDChannels[9][1] = 250;
   LEDChannels[9][2] = 350;
 
   WriteLEDArray();
   delay(200);
 //8   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 0;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 0;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 0;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 350;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 250;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 0;
   LEDChannels[8][1] = 250;
   LEDChannels[8][2] = 350;
 
   LEDChannels[9][0] = 0;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 800;
 
   WriteLEDArray();
   delay(200);
//9   
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 0;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 0;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 0;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 0;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 0;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 0;
   LEDChannels[8][1] = 300;
   LEDChannels[8][2] = 420;
 
   LEDChannels[9][0] = 0;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 1023;
 
   WriteLEDArray();
   delay(200);
//10 
   LEDChannels[0][0] = 0;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 0;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;
   
   LEDChannels[2][0] = 0;
   LEDChannels[2][1] = 0;
   LEDChannels[2][2] = 0;
 
   LEDChannels[3][0] = 0;
   LEDChannels[3][1] = 0;
   LEDChannels[3][2] = 0;
   
   LEDChannels[4][0] = 0;
   LEDChannels[4][1] = 0;
   LEDChannels[4][2] = 0;
 
   LEDChannels[5][0] = 0;
   LEDChannels[5][1] = 0;
   LEDChannels[5][2] = 0;
   
   LEDChannels[6][0] = 0;
   LEDChannels[6][1] = 0;
   LEDChannels[6][2] = 0;
 
   LEDChannels[7][0] = 0;
   LEDChannels[7][1] = 0;
   LEDChannels[7][2] = 0;
   
   LEDChannels[8][0] = 0;
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 1023;
 
   LEDChannels[9][0] = 0;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 1023;
 
   WriteLEDArray();
   delay(800);
}

See this for an example of how to do it:-
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253503406

Thanks for the link, I have implemented the fadeall() function but still can't get that smooth transition. I will play with it. Thanks

I can't seem to get this to function, I keep getting:
fadetest.cpp: In function 'void loop()':
fadetest:102: error: invalid conversion from 'void (*)(int)' to 'int'

What am I doing wrong here?

void fade(int Steps) 
{
  if (Steps >= 0) 
  {
    Steps = 64;
  }
    else if (Steps <= 0)
    {
      Steps = 1023; 
    }
      else if (Steps >= 1023) 
      {
        Steps = 0; 
      }
}

void loop() {
 
  //1
   LEDChannels[0][0] = fade;
   LEDChannels[0][1] = 0;
   LEDChannels[0][2] = 0;
 
   LEDChannels[1][0] = 1023;
   LEDChannels[1][1] = 0;
   LEDChannels[1][2] = 0;

You need to post the bit of the code that gives the error. That is where you are trying to call that function.

It sounds like you are not using the right argument to pass to the function.

The most recent code I posted is giving me the error.

This line particularly:
LEDChannels[0][0] = fade;
LEDChannels[0][1] = 0;
LEDChannels[0][2] = 0;
...
...There are 10 LEDs worth of code, I just omitted all those..
...
WriteLEDArray();

fadetest.cpp: In function 'void loop()':
fadetest:102: error: invalid conversion from 'void (*)(int)' to 'int'

If I pass that line a variable, i.e..
LEDChannels[0][0] = fade(65);

The code will compile correctly but It does not fade..
Think I'm going about this a**backwards...

Well that last code you posted makes no sense at all.

  1. You can't assign a function to a variable.
    so writing
    LEDChannels[0][0] = fade(65);
    simply sets LEDChannels[0][0] to the value returned by the fade function. The function is defined as void which means it doesn't return a value anyway.

  2. That fade() function doesn't do anything anyway.

The code will compile correctly but It does not fade

That is because you are not doing any fading at all.

To fade you need to

  1. write the brightness values into the LEDChannels array.
  2. call the WriteLEDArray();
  3. delay for some time to allow you to see that brightness
  4. change the value and go back to 1

This needs to be in a loop that repeats until the fade is done.

Well that makes sense. Thanks for the help. I will eventually figure it out.

I'm still lost here and have been looking through every fade sketch I can find that involves shiftbrites.
I think its the SPI interface that is boggling me.

I have my sketch (without fading) setup how it needs to be. (Thanks to robtillaart & Grumpy_Mike)

But even looking at all the examples I have come across I don't know how to implement the fade as I need it.
yes I can make the shiftbrites fade to different colors but only all at once, not individually fade to different colors at the same time.

I know its nobody's job on here to do this for me but I'm stumped and have been with this part for a while now.
Here is the current code. (Which all fits in one post now, YAY!)

//LNG Lighting
const int clockpin = 13; // DI
const int  enablepin = 10; // LI
const int latchpin = 9; // EI
const int datapin = 11; // CI

const int NumLEDs = 10; // Number of LEDs in chain
 
int LEDChannels[NumLEDs][3] = {0};
int SB_CommandMode;
int SB_RedCommand;
int SB_GreenCommand;
int SB_BlueCommand;
 
void setup() {
 
   pinMode(datapin, OUTPUT);
   pinMode(latchpin, OUTPUT);
   pinMode(enablepin, OUTPUT);
   pinMode(clockpin, OUTPUT);
   SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR1)|(0<<SPR0);
   digitalWrite(latchpin, LOW);
   digitalWrite(enablepin, LOW);
}
 
void SB_SendPacket() {
 
    if (SB_CommandMode == B01) {
     SB_RedCommand = 120;
     SB_GreenCommand = 100;
     SB_BlueCommand = 127;
    }
 
    SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_BlueCommand<<4 | SB_RedCommand>>6;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_RedCommand << 2 | SB_GreenCommand>>8;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_GreenCommand;
    while(!(SPSR & (1<<SPIF)));
}
 
void WriteLEDArray() {
 
    SB_CommandMode = B00; // Write to PWM control registers
    for (int h = 0;h<NumLEDs;h++) {
	  SB_RedCommand = LEDChannels[h][0];
	  SB_GreenCommand = LEDChannels[h][1];
	  SB_BlueCommand = LEDChannels[h][2];
	  SB_SendPacket();
    }
 
    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);
 
    SB_CommandMode = B01; // Write to current control registers
    for (int z = 0; z < NumLEDs; z++) SB_SendPacket();
    delayMicroseconds(15);
    digitalWrite(latchpin,HIGH); // latch data into registers
    delayMicroseconds(15);
    digitalWrite(latchpin,LOW);
}

void loop() {
//1
   for (int i=0; i<10; i++)
   {
     LEDChannels[i][0] = 1023;
     LEDChannels[i][1] = 0;
     LEDChannels[i][2] = 0;
   }
   WriteLEDArray();
   delay(200);
//2    
   LEDChannels[0][0] = 200;
   LEDChannels[1][0] = 500;
   LEDChannels[2][0] = 700;
   LEDChannels[8][0] = 900;
   LEDChannels[9][0] = 900;

   WriteLEDArray();
   delay(200);
//3  
   LEDChannels[0][0] = 0;
   LEDChannels[1][0] = 200;
   LEDChannels[2][0] = 500;
   LEDChannels[3][0] = 700;
   LEDChannels[8][0] = 900;
   LEDChannels[9][0] = 700;
  
  WriteLEDArray();
   delay(200);
//4   
   LEDChannels[2][0] = 200;
   LEDChannels[3][0] = 500;
   LEDChannels[4][0] = 700;
   LEDChannels[5][0] = 900;
   LEDChannels[6][0] = 900;
   LEDChannels[7][0] = 800;
   LEDChannels[8][0] = 700;
   LEDChannels[9][0] = 500;

   WriteLEDArray();
   delay(200);
//5   
   LEDChannels[1][0] = 0;
   LEDChannels[2][0] = 0;
   LEDChannels[3][0] = 200;
   LEDChannels[4][0] = 500;
   LEDChannels[5][0] = 700;
   LEDChannels[6][0] = 700;
   LEDChannels[7][0] = 700;
   LEDChannels[8][0] = 500;
   LEDChannels[9][0] = 300;

   WriteLEDArray();
   delay(200);
//6   
   LEDChannels[3][0] = 0;
   LEDChannels[4][0] = 200;
   LEDChannels[5][0] = 500;
   LEDChannels[6][0] = 500;
   LEDChannels[7][0] = 300;
   LEDChannels[8][0] = 200;
   LEDChannels[9][0] = 100;

   WriteLEDArray();
   delay(200);
//7   
   LEDChannels[4][0] = 0;
   LEDChannels[5][0] = 200;
   LEDChannels[6][0] = 300;
   LEDChannels[7][0] = 200;
   LEDChannels[8][0] = 100;
   LEDChannels[9][0] = 0;
   LEDChannels[9][1] = 250;
   LEDChannels[9][2] = 350;
 
   WriteLEDArray();
   delay(200);
//8   
   LEDChannels[5][0] = 0;
   LEDChannels[6][0] = 350;
   LEDChannels[7][0] = 250;
   LEDChannels[8][0] = 0;
   LEDChannels[8][1] = 250;
   LEDChannels[8][2] = 350;
   LEDChannels[9][1] = 0;
   LEDChannels[9][2] = 800;
 
   WriteLEDArray();
   delay(200);
//9   
   LEDChannels[6][0] = 0;
   LEDChannels[7][0] = 0;
   LEDChannels[8][1] = 300;
   LEDChannels[8][2] = 420;
   LEDChannels[9][2] = 1023;
 
   WriteLEDArray();
   delay(200);
//10 
   LEDChannels[8][1] = 0;
   LEDChannels[8][2] = 1023;
   LEDChannels[9][2] = 1023;
 
   WriteLEDArray();
   delay(800);
}

The SPI stuff is not what's causing you problems, since that's all completely abstracted out. If you just use the WriteLEDArray() functions as delivered, you simply have a 1xN "screen" of RGB pixels in LEDChannels[N][3]. So the part that's causing you problems is figuring out your graphics algorithms...you would be having the same problems if you tried to write the program in Visual Basic or Processing. You just need to step back and think of how you can tell each pixel to be the correct color at various points in time.

Ok, a sat back and stared at it the code a while wondering how to go about this and have come up with an idea. Please tell me if there is an easier way to try to go about this and/or what yall think about this idea.

I'm thinking I need to implement a for loop that will read the values of each led and use that value as the max and fade it to zero from there (for my red LEDs only) and use a separate for loop for the last 2 leds in the string which fades them from red to cyan to blue.
?

This is what I was thinking....

//1
for (int i=0; i<10; i++) <-- Line 65 it is referring to.
{
LEDChannels*[0] = 1023;*
_ LEDChannels*[1] = 0;_
_ LEDChannels[2] = 0;
}
WriteLEDArray();
delay(2000);
//2
for (int i=1023; i=1023; (i-200));
{
LEDChannels[0][0] = i; <-- Line 76 it is referring to.
LEDChannels[1][0] = i;
LEDChannels[2][0] = i;
LEDChannels[8][0] = i;
LEDChannels[9][0] = i;
}
WriteLEDArray();*
I keep getting:_

basicShiftbrite.cpp: In function 'void loop()':
basicShiftbrite:76: error: name lookup of 'i' changed for new ISO 'for' scoping (this is in //2)
basicShiftbrite:65: error: using obsolete binding at 'i'

I have been trying to lead you in the right direction, but not providing too many details, because I didn't want to cheat you out of the thrill of success when it all clicked and you figured it out. (Maybe you don't believe in this, but if someone helps me too early it's like spoiling the end of a movie, or pointing out the piece of the puzzle I was trying to find.)

The final, root cause of the problem here is that you don't know how to write code in C. OK...few people really ever truly do know how, but most programmers and many electrical engineers have a working ability in it. This is the course of action I recommend:

  1. For this project, just ask for a solution. I could write the code for you pretty quickly.
  2. For future projects, go get a book about C programming and work through it. Find one that suits your learning style and speed. Many would recommend Kernighan & Ritchie, you might find something else that works well. The Sams books aren't all bad...just don't expect to actually learn C in 24 hours.

Absolutely, 100% do not be embarrassed by this. I can see that you have been trying hard to get this to work, you ARE learning (just not in a structured enough manner) and you are far beyond many of the people who come into these forums asking only for cut & paste solutions, and who refuse to learn anything at all. I know for a fact you will pick up C quickly, and probably come back in here to teach us a few things. :slight_smile:

Let me know if you want a code example that shows the LED effect you're hoping to see.

Think "blink without delay" sort of structure enlarged to cope with say three LEDs, but instead of just turning an LED on or off when the millis() count gets exceeded just alter the value in one LED colour and write out your array again.

In this way you get different fades going on at the same time.