Would there be a way to only use every other,

Would there be a way to only use every other, or every third LED in the strip either by defining the array to only use those LEDs or making .show() only use those? I would like to add a simple option in my effects examples to skip n LEDs on the strip. Is this possible by this method or will I have to find a way by increment in all the loops?
Thanks!

You’d have to do it by increment in the loop. Though for the next library release (after 2.0) I’m building a bunch of classes to “map” to LEDs, to make doing 2d arrays and other such arrangements easier. I’ll add a “skip list” option so you could have an array of LEDs that would write to only every 3rd under the hood.

Yeah, increment in the loop. What I do is set a variable, say the number 2. Then, in the loop I can compare the current pixel with that variable by doing a modulus comparison.

if (px % variable) {
// do something if the result was 0
} else {
// do something if the result is anything other than 0
}

This way I can easily change how many pixels I want skipped simply by changing the variable.

@Daniel_Garcia Awesome! That would be a great option to have. Thanks so much for the quick reply too. Can’t thank you enough for all your work on this library!

Also- that last sentence in your post “And we haven’t even started talking about [REDACTED]!” has been gnawing at me. Was that a hint about the 2d arrays or are you brewing up some other magic too? :wink:

@Ashley_M_Kirchner_No Cool, thanks! I was just hoping to find another way since I have about 30 different effects and I’ll have to change a whole lot of loops to work that in. Appreciate the reply!

Now that would be telling, wouldn’t it? I’m back to being able to dedicate at least 1 solid day/week to this stuff, though - so hopefully I’ll get through my backlog (the 2.1 branch already has a whole bunch of work done on it, and I have an auxiliary library that’s coming along nicely that isn’t even checked in yet. There’s also still some housekeeping to do - moving to github, getting some more docs up that I’m behind on. Protip - don’t burn yourself out on projects - you never know how long it’ll take to unfunk yourself!)

That’s good advice. Thanks!