Greetings everyone, new guy here. I am working on a project where I am using 63 through-hole neopixels. What I want to do is assign individual pixels to different groups and then use the code to turn the groups on or off. Here is a basic diagram if what I am trying to achieve :
-- E --
-- D --
-- C --
-- B --
-- A --
-- E --
-- D --
-- C --
-- B --
-- A --
-CORE-
-- A --
-- B --
-- C --
-- D --
-- E --
-- A --
-- B --
-- C --
-- D --
-- E --
Each layer of this layout has 3 LEDs, so each group A through E would have 15. The goal is to daisy chain the pixels from bottom to top to control via one data pin. Any suggestions are appreciated.
But for the world to me it seems like a very logical order. So if you want to turn on all E and E is every 5th led starting at the first then you can loop over all them by
for(byte i = 0; i < numberOfLeds; i += 5){
turnOnLed[i];
}
[code]
The goal is to have light pulsing from both the top and bottom toward the center, as per the warp core from Star Trek. I was hoping to be able to simply use #define for each group such as:
Your #defines do not define anything except that they may be tested with an #ifdef. Normal usage is: #define <actual_name>
I can't think of anything useful you could define them to be.
If you are going to use the fastLED library, I think you may be headed down the wrong path anyway. (I don't use that library myself). Are you planning to write your own driver for the LEDs, or use someone's driver, or use another library?
Yeah, I don't use that either (I don't believe in libraries). You should study the API (user interface) for that library and see what it requires.
I'll have to bow out of this thread a let more knowledgeable people respond.
If the LEDs are in related positions then you can use an algorithm to access them, like has been discussed above. If they are arbitrary then define each group in an array or better a two dimensional array for the whole lot.
What you are trying to achieve is not clear. Not everyone watches SI-Fi onTV.
Can't agree more with Mike! You can't group them with a define, you need a function to set every led you want.
boolrules:
If these really are neopixels, then there are going to be 3 bytes per led:
3 * 3 * 21 = 189 bytes in the array.
So mod the formula appropriately.
Please don't, FastLed or Adafruit_NeoPixel both use led numbers, not color numbers. That each led is 3 bytes/colors is all handles by the library functions.
boolrules:
If you are going to use the fastLED library, I think you may be headed down the wrong path anyway.
I don't think so, I would call that the right path. Like the FastLed library over the Adafruit_NeoPixel library. Way more options for good color representation including HSV.
boolrules:
I don't believe in libraries
I would say that's quite foolish.... Why are you using Arduino then? Arduino is all based on libraries. Arduino comes packet with libraries. And not every library may be as good but I would say it's foolish to not use a library in this day and age.
Yes, I agree on the "using a library"-part. But that's not manhandling the color arrays in my opinion. The library is the interface between the Arduino and the leds. Which leds you want to show which color is up to the person using the library. So many wishes, so many implementations. So impossible to have a (at least not self written) library that just happens to exactly a very specific task you happen to need.