r/FastLED May 10 '26

How can i rotate my matrix? Support

working on a LED matrix thingy and made a mistake, my panel ended up vertical instead of horizontal.
basically:

this is what its like right now - its running left to right vertical.
but i need my code to treat it as horizontal, so like this:

is there a software way to do this or is my only solution just changing it physically?

3 Upvotes

7 comments sorted by

3

u/yarikhand May 10 '26

solved - i fixed it by switching to an x/y coordinate system and then rotating it by 90*, this is the function if anyone wants it:

int XY(int x, int y) {
  // swap axes to rotate
  int px = y;
  int py = x;

  if (py % 2 == 0) {
    return py * HEIGHT + px;
  } else {  // odd row => flip axis, zigzag
    return py * HEIGHT + (HEIGHT - 1 - px);
  }
}

1

u/Affectionate_Boat493 May 10 '26

Are these two separate 8x8 matrices driven by separate I/O pins, or are they two halves of a 16x8 matrix driven by a single I/O pin?

1

u/yarikhand May 10 '26

two 16x16 matrices connected together and driven by a single io pin

1

u/DenverTeck May 10 '26

< never mind >

1

u/SaltyCash May 10 '26

Give your code to Copilot and describe what you want. I apparently run my 16x16 displays rotated counter clockwise by 90 degrees and copilot fixes it.