Static Color Pattern

Hello all,

I am very new to this style programming and hope that someone will be able to make this a little more simple for me. I have been programming PLC for the length of my career but this is a very new en-devour of mine. I have been working on a project with the WS2812 30led/1m strips. (150led total). I have also followed several of the tutorials with success being able to turn on individual LED’s in the color of my choosing as well as starting to make the lights move.

My question is:

is there a shorter way to program a static color pattern rather than addressing each individual led like in the example code ive attached? I have messed with the arrays a little bit but it seems those are more usful for creating blocks of color rather than a simple 5 color repeating pattern like i am attempting.

/********** DEFINITIONS **********/
#include <FastLED.h>
#define NUM_LEDS 150
#define DATA_PIN 5

CRGB CC_1=(24,2,153);

void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);

void loop() {

leds[0] = CRGB::Red;
leds[1] = CRGB::Green;
leds[2] = CC_1;
leds[3] = CRGB::Yellow;
leds[4] = CRGB::Purple;;

New_Program.ino (948 Bytes)

Please read “Read this before posting a programming question” at the top of the forum. Use code tags.

So, if I understand your question, you want each five leds to be red, green, dark lime green, yellow and purple to be repeated 30 times?

I am not aware of custom patterns, so I would do a loop.

for (int i=0; i< 30; i+=5){
    leds[i] = CRGB::Red;
    leds[i+1] = CRGB::Green;
    leds[i+2] = CC_1;
    leds[i+3] = CRGB::Yellow;
    leds[i+4] = CRGB::Purple;

(Note, untested code)

ALSO- Click on Report to Moderator and ask that this thread be moved to LEDs.