How can I create a pattern to cycle through a specific set of colors. I wrote code that manually forces the colors to change, but want to have this pattern added to a loop and the way i have it the time is not working properly
I want to set all LEDs to cycle these 6 colors but i want every 6th LED a specific color so it keeps this color pattern through 200 LEDs, not all 200 LEDs red, then white, then green as an example. but LED 0 is white, LED 6 is white and so on. then after say 600ms LED 0 becomes Red and LED 6 is also Red and so on through the pattern and then start over in a loop
//WalkingMarkeeVer2
#include <Adafruit_NeoPixel.h>
#define wait 500 //viewing time
bool allowWalking = true; //true >>>---> allows the colors to walk
// false >>>---> stationary
#define ledCount 200 //total number of LEDs
#define PIN 6 //output pin to the LED strip
#define LEDsPerBoard 6 //number of LEDs on a PCB
int offset = 0; //offset or index into colourArray[]
unsigned long colourArray[] = //colour code sequence
{
//example 1:
//red green blue pink yellow white cyan orange black
//0xFF0000, 0x00FF00, 0x0000FF, 0xFF00FF, 0xFF7F00, 0xFFFFFF, 0x00FFFF, 0xFF3000, 0x000000
//example 2:
//red green blue white
//0xFF0000, 0x00FF00, 0x0000FF, 0xFFFFFF
//example 3:
//red red green green blue blue pink pink white white
//0xFF0000, 0xFF0000, 0x00FF00, 0x00FF00, 0x0000FF, 0x0000FF, 0xFF00FF, 0xFF00FF, 0xFFFFFF, 0xFFFFFF
//example 4:
//red green blue pink yellow white
0x3F0000, 0x003F00, 0x00003F, 0x3F003F, 0x3F3F00, 0x3F3F3F //dimmer
//example 5:
//red green blue pink yellow white
//0xFF0000, 0x00FF00, 0x0000FF, 0xFF00FF, 0xFF9F00, 0xFFFFFF //bright
//example 6:
//red green blue
//0xFF0000, 0x00FF00, 0x0000FF //bright
//example 7:
//red green blue
//0x3F0000, 0x003F00, 0x00003F //dimmer
};
//how many colours do we have
const byte availableColors = sizeof(colourArray) / sizeof(unsigned long);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(ledCount, PIN, NEO_GRB + NEO_KHZ800);
//***********************************************************************************
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}// END of setup()
//***********************************************************************************
void loop()
{
//cycle through all the colours
for (byte colourSelect = 0; colourSelect < availableColors; colourSelect++)
{
//fill the pixel array memory
for (byte ledNumber = 0; ledNumber < ledCount; ledNumber++)
{
strip.setPixelColor(ledNumber, colourArray[offset]);
//the next index/offset into colourArray[]
offset++;
offset = offset % availableColors;
}// END of for()
//send the pixel array memory to the LEDs
strip.show();
//give some time to view the strip
delay(wait);
//*********************
//move to the next item in colourArray[]
if (allowWalking == true)
{
offset = colourSelect;
}
//*********************
}// END of for()
}// END of loop()
//***********************************************************************************