Pages: [1]   Go Down
Author Topic: LED Blossom 32rgb 3w tlc5940  (Read 907 times)
0 Members and 1 Guest are viewing this topic.
Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a sample of my new LED blossom.



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);
 }
  }
}



* blossomlayout.png (11.56 KB, 640x400 - viewed 16 times.)
« Last Edit: December 13, 2012, 02:24:14 am by Krolo » Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2484
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any reason the array needs to be multi dimensional? Could you use a single dimension array like
Code:
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.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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;
 }
 }
 }
}
Logged

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm, both these functions yield no output


Code:
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;
   }
 
 }
 }
}
Logged

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I got this working.

Logged

Norfolk UK
Offline Offline
Edison Member
*
Karma: 66
Posts: 2484
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking good.
Logged

There is no such thing as a stupid question but there are a lot of inquisitive idiots.

Denver, CO
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a more complete video.

Logged

Pages: [1]   Go Up
Jump to: