Fastled XY matrix using the serpentine style wiring

FlAME SUIT ON. Ill do my best to be quick to the point.

Hello all,

Bit of background: well rounded mechanically inclined individual who mostly builds cars and home upkeep projects(Bathrooms,kitchens,deck repair…simple things ect) By trade i am a CAD designer.

Task:

I’ve taken on a project that requires a bit of LED codding and i’ve done a fair amount of research or what I consider fair.

I’ve done a lot of the tutorials and such related to the the FAStled Library and their XY matrix but still haven’t quiet found what im looking for. Digging through the example file im just not finding what im looking for or its quiet possible its right in front of me but Im just doing it wrong.

I really just need to make a grid and have 3 leds chase or run the path it is on.

For a hypothetical example the grid will look like this( using bits of code to outline the environment im working with I understand it wont work to control anything at this time)

#define COLOR_ORDER GRB
#define CHIPSET WS2811 // strip

const uint8_t kMatrixWidth = 27;
const uint8_t kMatrixHeight = 15;

//
// 0 > 1 > 2 > 3 > 4
// |
// |
// 9 < 8 < 7 < 6 < 5
// |
// |
// 10 > 11 > 12 > 13 > 14
// |
// |
// 19 < 18 < 17 < 16 < 15

Im looking to command individual rows of the leds to just chase down until it ends then start over at the first led of the row it started.

Im not asking for someone to do it for me. Does anyone know of a tutorial video, website to get me started on controlling individual leds BEYOND the provided example file for the XY MAtRIX

Ei Commanding X1, Y4 led to turn on and shut off for a certain time.

I understand google is your friend, and x amount of research could possibly yield the direction im looking for but for the first time in a while google has not been my friend, and ive been looking for a few days now.

pattern.PNG

I think you need to consider a simple function to convert normal X - Y coordinates into an LED number that the libiary can use. This piece of code is written for a column serpentine matrix but it easily converted into a row one like you have.

The conversion from X - Y values to strip values are just a little more involved but that what software is for. In the case of even numbered columns the conversion is simply what we had before, with:-
LED number = Y + (X * number of LEDs in a column)
However for odd numbered columns the conversion is :-
LED number = (X * number of LEDs in a column) + (number of LEDs in a column -1 -Y)
To determine if the X coordinate is odd or even, simply look at the least significant bit of the X value and if it is a zero then it is an even column or if it is a one it is an odd column. So all the software has to do is to examine the X - coordinate and decide what formula to use. It is simple enough to make a function that returns the LED number given the X & Y values.

int getLEDpos(int x, int y){ // for a serpentine raster
   int pos;
   if(x & 0x1) { // is X odd
      pos = x * yMax + (yMax -1 - y) ;
   } else { // x is even
      pos = x * yMax + y;
   } 
   return pos;
}

Where yMax is the number of LEDs in a column.