I've got 5 strips of 60 pixels arranged vertically around my Christmas tree,

(Christopher Kirkman) #1

I’ve got 5 strips of 60 pixels arranged vertically around my Christmas tree, each on their own data pin, running on an Uno using the setup from the Multiple Controllers example using an offset. No complaints really, but I thought maybe the patterns and gradients might looks better if the order of the pixels were mapped differently.

Instead of vertically, 1 strip to the next, I thought it might look better if I were to order them horizontally, so the array would be like [Strip1LED0, Strip2LED0…Strip1LED1, Strip2LED1…] etc… (does that make sense).

I tried writing a FOR statement to map them like that, but I’m pretty sure my syntax is wonky because as soon as I try to compile, I get out of memory errors. I’d like to store this layout in addition to the vertical layout so I can change up patterns and such. Maybe this is an XY Grid thing? I dunno. Please send suggestions :).

(Marc Miller) #2

Sounds like you’re on the right track.
Can you post the part of your code that builds your arrays to http://gist.github.com ?

Making an XY map would work too.

(Christopher Kirkman) #3

That’s my working setup. The simplest of multi-pin strip arrays, but it stores them in order starting with Pin 3, 0-59, then Pin 4 0-59, but offset to store into the array at position 60. So on and so forth.

My initial thought was to write a FOR statement, like I mentioned, but I think my logic is flawed since the addLeds function only works with totals per strip, so I’m not sure I can just iterate and offset how it is in my head where

leds[0] = Pin3Led0
leds[1] =Pin4Led0
leds[2] =Pin5Led0

(Marc Miller) #4

Hmmm, yeah. Perhaps doing an XY map would work better.

(Christopher Kirkman) #5

Here’s the entire sketch: https://gist.github.com/ctkjedi/e645b2710fd83ea83b111e832c3288f6. I’m just running palettes for now. Just thought those palettes would look better if they mapped as if they were twirling their way around and down the tree rather than just straight down each strip.

Here’s a pic for good measure: https://photos.app.goo.gl/ZqyGjNPoLT5yu6Xp9

(Christopher Kirkman) #6

@marmil How would the XY Mapping work with the colorwaves function in this case? Colorwaves references the CRGB array directly, correct?

(Ken White) #7

@Christopher_Kirkman1 - You might be able to adapt @Jason_Coon 's V2 Tree mapping technique to your tree. It can be found with the code at:


Also, you can see how I adapted Jason’s mapping method to a 8X8 matrix. This might get you the animation looks that you desire. See my post and code at:

with a video at:

(Christopher Kirkman) #8

@Ken_White I’ve tried a bunch of things now and I keep falling back to the same errors: out of memory. Something about the number of LEDs or that they’re on different pins or something causes the memory usage to jump to 230+%. Here’s the sketch, in case anything stands out as wrong - https://create.arduino.cc/editor/jedimasta/86b16eae-28f1-48c0-afd7-8bbe76ccd5bd/preview

(Christopher Kirkman) #9

I went back and tried using the simplest form of the matrix that I could find, being Adafruit’s Jack O LED trix here: https://learn.adafruit.com/Jack-o-LED-trix/upload-code

What I found after adding my specific pin setup and removing code here and there was that the memory usage would jump from 236% down to 58% when I removed the mapNoiseToLEDsUsingPalette() function.

(Ken White) #10

@Christopher_Kirkman1 - If you look at the Jack-o’-LED•trix project, it is run on a Teensy LC. The Arduino Uno does not have enough memory for your code as you found out. Your code does compile on the Arduino IDE 1.8.7 for a Teensy 3.1/3.2 and for a Wemos d1 mini pro. You might want to try one of these MCUs.

(Christopher Kirkman) #11

I hadn’t even noticed they weren’t using an Uno. Thanks for the tip