Neopixel sketch to control 2 strips differently

I can turn on and control a Neopixel strip no problem. I want to be able to control two separate neopixel strips. Strip one and strip two. Have strip one turn on and be red, delay or wait X seconds then be blue. Strip two would turned on and be green then wait X seconds and then be purple. The sequence would only run once, once powered up and then stop.

Where are you stuck ?

What have you tried so far ?

So far this. Can't get it to light up.

#include <FastLED.h>

#define NUM_STRIPS 2
#define NUM_LEDS_PER_STRIP 30
CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP];

void setup() {
  FastLED.addLeds<NEOPIXEL, 6>(leds[0], NUM_LEDS_PER_STRIP);
  FastLED.addLeds<NEOPIXEL, 7>(leds[1], NUM_LEDS_PER_STRIP);

}

void loop() {
  {
    leds[6][30] = CRGB::Red;
    FastLED.show();
    delay(100);
    leds[7][30] = CRGB::Blue;
    FastLED.show();
    delay(100);
  }
}

I just simply want to turn strip 1 red. Wait x seconds and turn on strip 2 and make it blue. From there I can add more strips as part of the code.

I ended up with this. One odd thing red is green and green is red?????

#include "FastLED.h"

#define NUM_LEDS 80
#define NUM_STRIPS 4

CRGB leds[NUM_LEDS];
CLEDController *controllers[NUM_STRIPS];
uint8_t gBrightness = 128;

void setup() {
  controllers[0] = &FastLED.addLeds<WS2812, 1>(leds, NUM_LEDS);
  controllers[1] = &FastLED.addLeds<WS2812, 2>(leds, NUM_LEDS);
  controllers[2] = &FastLED.addLeds<WS2812, 6>(leds, NUM_LEDS);
  controllers[3] = &FastLED.addLeds<WS2812, 11>(leds, NUM_LEDS);
}

void loop() {
  // draw led data for the first strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Red);
  controllers[0]->showLeds(gBrightness);

  // draw led data for the second strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Green);
  controllers[1]->showLeds(gBrightness);

  // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Blue);
  controllers[2]->showLeds(gBrightness);

  // draw led data for the first strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::White);
  controllers[3]->showLeds(gBrightness);

  delay (1000);

  // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Black);
  controllers[2]->showLeds(gBrightness);

  delay (1000);

  // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::White);
  controllers[2]->showLeds(gBrightness);

  delay (1000);

    // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Black);
  controllers[2]->showLeds(gBrightness);

  delay (1000);

  // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Green);
  controllers[2]->showLeds(gBrightness);

  delay (1000);

      // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Black);
  controllers[2]->showLeds(gBrightness);

  delay (1000);

    // draw led data for the third strand into leds
  fill_solid(leds, NUM_LEDS, CRGB::Red);
  controllers[2]->showLeds(gBrightness);

  delay (5000);
}

Your code does not appear to be for your stated intention in the first post.

You can try changing

CRGB leds [NUM_LEDS];

on

CGRB leds [NUM_LEDS] ;

. This sets a different arrangement of bytes for color.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.