I've got a strip of 60 LEDs in a circle for a clock,

I’ve got a strip of 60 LEDs in a circle for a clock, but I want to define LED 30 as the start of the array, and LED 0 as the 31st pixel in the array (so the wire coming out of the circle is at the bottom)

Is there a way to define that setup in the FastLED.addLeds statement, or do I need to do the “if leds[n] is greater than 30, subtract 30, else add 30” to every line that I draw a pixel? Cause that will get old fast. Thanks for the help!

There’s no way to do anything like that in the addLeds statement. However, what you can do is say:

leds[(i+30)%60]

and that will effectively shift all your accesses over 30 elements.

The other alternative is to have a second array that you 0 index the way that you want:

leds_work[60];

and then before you call show move/rotate everything:

for(int i = 0; i < 60; i++) {
leds[(i+30)%60] = leds_work[i];
}

The second method with two arrays looks like it’ll be the way to go, putting everything in to one single line at the bottom of the page instead of screwing with every access of the array. Thanks for the super quick reply too! (:

Although… isn’t it easier to move the electrical connection?

Mike, in this case, no it’s not, since there’s a wood frame involved with the connection at the bottom, and no extra room to run wires (or even a wire) around to the top. So I have to do it in software.

Turn the frame upside down.

Thank goodness for being able to fix stuff in software!

I’m going to be doing something similar with a circle of LEDs connected at the bottom, and I’m considering having a clock function.
My thinking is that I use the leds[(i+30)%60] method to calculate the position of the hour, minute, and second hands. Just three quick calculations, not too bad. Then the rendering of the pattern that makes up those hands (and perhaps the 12 stationary carats) can all be done in units referenced to the bottom for clean code.

How about defining something like this at the top of your sketch:

#define LED[i] leds[(i+30)%60]