I'm building some animations for a 300 LED strip. WS2318b, if it matters at all.
Now I wanted to do some things just for a couple of LEDs and have discovered that I can do arrays.
int allOther[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
106, 107, 109, 110, 112, 113, 115, 116,
118, 119, 121, 122, 124, 125, 127, 128,
130, 131, 133, 134, 136, 137, 139, 140,
142, 143, 145, 146, 148, 149 };
This is so that only the last couple of every LEDs ligth up, but writing this array was awfully awkward. I am pretty sure there are shorter/smarter ways to achieve that, but I'm not really sure what search term I'm looking for.
I thought something along the lines of "
array1[]= not the first 200, and every third among the last 100)
array2[] = the ones not in array1
or like:
array3[]= every third LED
array4[]= every third LED but start at position 1
array5[]= every third LED but start at position 2
I'm not asking you to code it for me, I just want to know where I should look for if I want to learn how to declare arrays the smart way