So my LED strips are almost here.

So my LED strips are almost here. Once they get here, I have a new project - I’m replacing all the electronics in my Daft Punk helmet, with 7 vertical strips of LEDS. I want to set them up as a matrix, of 7 x whatever. Any suggestions for making this happen? I seem to recall the Adafruit folks coming up with matrix functions for this situation, but I’d really prefer to work with FastLED for obvious reasons. :slight_smile:

https://plus.google.com/114689543789013665296/posts/5Ato53LC8qb (explicit, dedicated led containers still a little bit out)

The short version is this: define a function called XY, something like this.
byte gWidth = 8; // or however wide your array is.
int XY(byte x, byte y) {
return (y * gWidth) + x;
}

Then any time you want to deal with a pixel in any way, where you used to provide a direct pixel number, like this
leds[ {pixel-number} ]
instead use your new function and the X and Y coordinates:
leds[ XY( {x-coord}, {y-coord} ) ]

Basically, you now have a helper function which takes the X and Y coordinates you’re aiming for, and computes what pixel number that is.

It may come out upside down or rotated from how you expect, or you may need to deal with a “serpentine” (actually, “boustrophedon”) pattern, but as Dan said, this has been discussed here and a quick search should turn up useful results, and it’s pretty quick to adapt them to your setup.

Here is some code Daniel helped me write months ago, and it’s a matrix! https://plus.google.com/105445034001275025240/posts/A6h5ZWwAjSw

Well, it’s sort of a moot point now. I managed to completely screw up the visor while removing the tinting, and now I can’t wear it anymore. I am a sad panda. :frowning:

if you get it back together, I did a matrix based on LPD8806 stris

So I had a thought. Would I get better performance if I split the matrix into columns and used a different pin for each?

I’m doing a 7x32 matrix, and it would be trivial to split that up. the wiring would be a bit more complex, but it would let all my strips be oriented the same way. it would use 7 pins, probably pins 2 - 9.

In the meantime, I’ve implemented a column copy and flip, so now I need to work on shapes, text, and scrolling. Text is going to be the hardest, especially if I want two sizes (3x5 and 5x7).

It really depends on how you have the whole structure wired. My grid project uses pixels and every other row and is treated like the positive x and y quadrant…

//converts cartesian coordinates into a index into a linear array
//r is for rows c is for columns
uint8_t pixel(uint8_t r,uint8_t c){
if(r%2==1) //for the odd rows
{ return(c+((r-1)*num_columns)-1);}
else
{ return(num_columns-c+((r-1)*num_columns));}
}