LED Mapping

This is a very generic tutorial on how to MAP physical LED pixels in a virtual space for animation/video rendering

1. Set up your LED Strip layout, in this example I’m using CD shape:


I have made it slightly more difficult to demonstrate how cool mapping is! the middle left 5pixels strips are separately connected.

So the 1st pixel is on the top right and the arrows indicate the flow of data.

2. Layout the LEDs in a spreadsheet, refer to mappingexample (its open office spreadsheet) the 1st block is just a layout of the top pic.

We make a GRID of pixels 15 wide x 10 tall and set up an array. I usually use a byte/char array(to save on ram) but if you have more than 255 LEDs you will need short int/int

short int ledMap[10][15];

We then initialize the array as per the spreadsheet, have a look at the “:ED MAPPING ARRAY” cell it basically contacts each row of each cell

3. we then set up our LED array, i’ll use neopixel for simplicity(we have 92 LEDs with 3 bytes per LED):

byte ledArray[92][3];

That sets up our matrix(virtual video frame) and LED data array. to change a pixel at any X, Y address all you have to do is?

ledArray[ ledMap[y][x] ][0] = red;
ledArray[ ledMap[y][x] ][1] = green;
ledArray[ ledMap[y][x] ][2] = blue;