Go Down

Topic: LED Blossom 32rgb 3w tlc5940 (Read 1 time) previous topic - next topic

Krolo

Dec 07, 2012, 11:01 am Last Edit: Dec 13, 2012, 08:24 am by Krolo Reason: 1
Here is a sample of my new LED blossom.

http://www.youtube.com/watch?v=1nHJLomus-M

I have attached the layout of the LED's. I am wanting to remap it so it will spiral into (or out of) itself.
I rearranged it into a multidimensional array but the function does not do anything, maybe i'm missing something easy:

int blue = 0;
int green = 32;
int red = 64;


void fibi(int endcount, int wait){

     
 int sequence[8][4]={    {0, 9, 18, 27},
                         {8, 17, 26, 4},
                         {16, 25, 5, 12},
                         {24, 6, 3, 20},
                         {7, 14, 21, 28},
                         {15, 22, 29, 3},
                         {23, 30, 2, 11},
                         {3, 1, 10, 19}
 };
 
 
 for (int howmanytimes = 0; howmanytimes < endcount; howmanytimes++){
 Tlc.clear();
  for (int k = 0; k < 4; k++){
 for (int i = 0; i < 8; i++){


for ( int j = 0; j < 96; j++){             //  this cycles the color wheel + 3 for each bluepower[?} etc..
choice[j] = choice[j] + 3;
if (choice[j] > 95 ){
  choice[j] = 0;
  }
}
 
 
Tlc.set(blue + sequence[k], bluepower[k]);
Tlc.set(green + sequence[k], greenpower[k]);
Tlc.set(red + sequence[k], redpower[k]);


}
 Tlc.update();
delay(wait);
}
 }
}


Riva

Any reason the array needs to be multi dimensional? Could you use a single dimension array like
Code: [Select]
byte sequence[] = {0,8,16,24,7,15,23,31,1,9,17 and the rest 3,11,19,27,4,12,20,28};
and just traverse it forwards/backwards to spiral in/out.

Krolo

Ah actually that should give me a nice spiral as well.
I'm going to try this and I hope it gives me a spiral as well just a bit sharper:
void fibi2(int endcount, int wait){

     
  int sequence0[4]=  {0, 9, 18, 27};
   int sequence1[4]= {8, 17, 26, 4};
   int sequence2[4]= {16, 25, 5, 12};
  int sequence3[4]= {24, 6, 3, 20};
  int sequence4[4]= {7, 14, 21, 28};
   int sequence5[4]= {15, 22, 29, 3};
   int sequence6[4]= {23, 30, 2, 11};
   int sequence7[4]= {3, 1, 10, 19};
 
 
 
  for (int howmanytimes = 0; howmanytimes < endcount; howmanytimes++){
  Tlc.clear();
 
  for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence0[k], bluepower[0]);
Tlc.set(green + sequence0[k], greenpower[0]);
Tlc.set(red + sequence0[k], redpower[0]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence1[k], bluepower[1]);
Tlc.set(green + sequence1[k], greenpower[1]);
Tlc.set(red + sequence1[k], redpower[1]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence2[k], bluepower[2]);
Tlc.set(green + sequence2[k], greenpower[2]);
Tlc.set(red + sequence2[k], redpower[2]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence3[k], bluepower[3]);
Tlc.set(green + sequence3[k], greenpower[3]);
Tlc.set(red + sequence3[k], redpower[3]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence4[k], bluepower[4]);
Tlc.set(green + sequence4[k], greenpower[4]);
Tlc.set(red + sequence4[k], redpower[4]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence5[k], bluepower[5]);
Tlc.set(green + sequence5[k], greenpower[5]);
Tlc.set(red + sequence5[k], redpower[5]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence6[k], bluepower[6]);
Tlc.set(green + sequence6[k], greenpower[6]);
Tlc.set(red + sequence6[k], redpower[6]);
}
for (int k = 0; k < 4; k++){
Tlc.set(blue + sequence7[k], bluepower[7]);
Tlc.set(green + sequence7[k], greenpower[7]);
Tlc.set(red + sequence7[k], redpower[7]);
}

  Tlc.update();
delay(wait);
  for ( int j = 0; j < 96; j++){
choice[j] = choice[j] + 3;
if (choice[j] > 95 ){
   choice[j] = 0;
}
}
}
}

Krolo

So here is what you suggested:
void fibi3(int endcount, int wait){

     
  byte sequence[32]=  {0, 9, 18, 27, 7, 15, 23, 31, 1, 9, 17, 25, 6, 14, 22, 30, 2, 10, 18, 26, 5, 13, 21, 29, 3, 11, 19, 4, 12, 20, 28};
 
 
  for (int howmanytimes = 0; howmanytimes < endcount; howmanytimes++){
  Tlc.clear();
   
  for (int i = 0; i < 32; i++){   
   
Tlc.set(blue + sequence, bluepower);
Tlc.set(green + sequence, greenpower);
Tlc.set(red + sequence, redpower);
}
  Tlc.update();
delay(wait);
  for ( int j = 0; j < 96; j++){
choice[j] = choice[j] + 3;
if (choice[j] > 95 ){
   choice[j] = 0;
   }

}
}
}

Seems simple enough, I'll upload a video of it when I get home.

Krolo

hmm, both these functions yield no output


Code: [Select]
void fibi3(int endcount, int wait){

     
  byte sequence[32]=  {0, 9, 18, 27, 7, 15, 23, 31, 1, 9, 17, 25, 6, 14, 22, 30, 2, 10, 18, 26, 5, 13, 21, 29, 3, 11, 19, 4, 12, 20, 28};
 
 
  for (int howmanytimes = 0; howmanytimes < endcount; howmanytimes++){
  Tlc.clear();
   
  for (int i = 0; i < 32; i++){   
   
Tlc.set(blue + sequence[i], bluepower[i]);
Tlc.set(green + sequence[i], greenpower[i]);
Tlc.set(red + sequence[i], redpower[i]);
}
  Tlc.update();
delay(wait);
  for ( int j = 0; j < 96; j++){
choice[j] = choice[j] + 3;
if (choice[j] > 95 ){
   choice[j] = 0;
   }

}
}
}

Go Up