I’m trying to map a cylinder and I’m having a difficult time of it. I’m building a lamp that will have 18 rings with 17 LEDs on each ring. I seem to be having some difficulty designing it and was wondering if anyone could give me a hand?
Sure! This map just builds off the pre-loaded “Ring” example.
I assumed each layered ring is wired sequentially, and that pixel index 0 is in the bottom layer.
function (pixelCount) {
var map = [];
var layers = 18;
var pixPerRing = 17;
for (layer = 0; layer < layers; layer++) {
for (i = 0; i < pixPerRing; i++) {
c = i / pixPerRing * Math.PI * 2
map.push([Math.cos(c), Math.sin(c), layer])
}
}
return map
}
But I need to shift 1 for the zags, to get it right. This week, next time I get time to play. (It’s also top down, as well as zigzag). Hopefully between the two, we can have a good example. I’ll recraft mine to have variables for up/down and zigzag/continuous.
I have one issue and I guess I don’t understand the code enough to fix it. The first row only has 16 pixels on it, as I needed room for the wiring from the pixelblaze. Everything else is perfect. How would I adjust for this offset?
This is a different take on a cylinder, and I haven’t yet made this in pixelblaze, but I made a thing where I wrapped a pole in a single long line of LEDs (actually 7 attached strings). Since I wrapped it at a fixed number of pixels per loop (mostly) it lined up in an easily addressable way. It ends up as a long helix. The mapping is something like this:
That is a bit deceptive due to the large number of loops I used in that one, it is a true helix where there is a continuous gradient of height. Here is an example with less loops.
Yes, but the difference between the two is just one thing: does a row maintain a consistent height (and then a drop/rise to the next row), or is it a gradient to the next level with each slightly higher or lower? Otherwise the math is the same.
True, but for me it is trivial to run a long single loop of leds (and occasionally inject voltage), and much more of a pain to wire up several small loops.
Oh completely understand. In my case, I inserted LEDs of a strand into a sheet of plastic (which was supposed to be used as core of a plastic lamp) so it was super easy to make a zigzag matrix of it, rather than any other method. Do whatever works, as doing the mapper afterward is pretty easy (and I’m trying to help make it easier)
I need to take a photo of that lamp, will post it as part of a pile of stuff I’m working on. My to-do list grows.
I was going to try to do a correct conical mapping for fun, but then I did a search for it, and found that the wizard had already done one AND had a nearly identical cylindrical mapping. Is there a place where various mappings can be found?
We’re in the midst of a reorganizing, and mapping is part of that. Searching the forum is your best bet for now. Hopefully by 2021, it’ll be easier to find a large selection of maps and flexible mapping code to solve most common setups.
warning: i’m new with no coding or mapping experience
I’ve just started on a new project (Pineapple) that involves a cylinder which has 16 vertical strips with 14 pixels per strip wired in an up/down pattern. I’d like to map this so I can attempt (key word) to apply patterns that can a) travel up and down the cylinder, and b) travel clockwise and counter clockwise around the cylinder both vertical and diagonal (off-set).
I tried modifying some of the code above but failed miserably. I’m also not comprehending how the mapping code interacts with the pattern code so that the pattern matches the map.
Any advice or examples would be greatly appreciated.
vertical strips, up and down… going around in a circle.
you could just call it a 2d map, and it’ll work fine… it’s a zig zag, left right left, if you turn the cylinder on it’s side. Right? Ah, no, it’s reversed, looking at the wires above, it’s up (right), left (down), and so on.
If you want it to be 3d, we can build a map for that, but I suspect the simple 2d map (16x14) will work for most of what you want… so long as it’s right/left/right… not left/right/left