Mapping help for 4 strings going up a pole

Hi all,

Can y’all help me out with proper code to map an LED totem I’m building?

It consists of four strings of 75 pixels going vertically up a pole.
So the overhead view is:
0
0X0
0

Where the 0’s are pixels and the X’s is the pole in the center. They’re wired sequentially as you progress clockwise around if you’re looking down from the top, like so:

1
4X2
3

Where 1 is pixels 1-75, 2 is pixels 76-150, 3 is pixels 151-225 and 4 is pixels 226-300. Each start at the bottom of the pole with the lowest number and progress to the highest at the top.

Not sure if it matters, but it’s SK6812 with 60pixels/meter. And the pole is 1/2inch in diameter.

Sorry for the dumb question, but I’m not much of a coder. Hopefully I’ve explained it clearly?

Hi @AnarchyInTheUSA ,

Give this a try. It makes each of the 4 strips one at a time using a very similar recipe. The X and Y are positioned to the top, right, bottom, and left.

Since this is a tall and thin pole, the difference between the 4 pixels at a given height is very small, many patterns will likely render very similar values for them using the Contain mode. You can play around with larger r values, or switch to Fill mode.

function (pixelCount) {
  var r = 25.4/4 //strip radius in mm from center for half inch diameter 
  var s = 1000/60 //strip LED spacing in mm for 60 per meter
  
  var map = []
  
  //"top" pixels: center x on 0, y is up a bit, and z goes up with i
  for (i = 0; i < 75; i++) { //loop 75 times
    map.push([0 * r, 1 * r,  i * s])
  }
  
  //"right" pixels: x is right a bit, y is centered on 0, and z goes up with i
  for (i = 0; i < 75; i++) { //loop 75 times
    map.push([1 * r, 0 * r,  i * s])
  }
    
  //"bottom" pixels: center x, y is down a bit, and z goes up with i
  for (i = 0; i < 75; i++) { //loop 75 times 
    map.push([0 * r, -1 * r,  i * s])
  }
  
  for (i = 0; i < 75; i++) { //loop 75 times
    //"left" pixels: x is left a bit, y centered, and z goes up with i
    map.push([-1 * r, 0 * r,  i * s])
  }
  return map
}
1 Like