Controlling Multiple WS2812B Strips from 1 Uno

Hi all!

I have two WS2812B strips that I am trying to control via a single Uno. From what I am able to gather from similar posts on the net, I can see that you are able to use two different data pins to control two different LED strips, but the code is what I am having a hard time figuring out. I'm posting the code that I currently use to control a single strip, but I don't know what code to alter/add in order to control another strip.

For ease, could someone look at my code below and tell me what I need to do in order to duplicate the same effect on a second strip ( in this code, I'm simply turning on 5 of 18 LEDs)? I'm still fairly new to Arduino, so I'm still trying to figure out the coding, and the one other example I found similar to my request had code that looked much different fundamentally than what I'm using, so I was immediately lost. Thanks in advance!

#include <FastLED.h>

#define NUM_LEDS 18

#define NUM_OTHER 18

#define DATA_PIN 2

#define COLOR_ORDER GRB

#define CHIPSET WS2812B

#define BRIGHTNESS 100

#define VOLTS 5

#define MAX_AMPS 500

int time1 = 30;

int C1 = 0;

int C2 = 0;

int C3 = 255;

//some settings above due to using onboard 5v power

CRGB leds [NUM_LEDS];

void setup() {

// put your setup code here, to run once:

FastLED.addLeds<CHIPSET,DATA_PIN,COLOR_ORDER>(leds,NUM_LEDS);

FastLED.setMaxPowerInVoltsAndMilliamps (VOLTS,MAX_AMPS);

FastLED.setBrightness (BRIGHTNESS);

FastLED.clear();

FastLED.show();

}

void loop() {

// put your main code here, to run repeatedly:

leds[0] = CRGB(C1,C2,C3);

leds[1] = CRGB(C1,C2,C3);

leds[2] = CRGB(C1,C2,C3);

leds[3] = CRGB(C1,C2,C3);

leds[4] = CRGB(C1,C2,C3);

leds[5] = CRGB(0,0,0);

leds[6] = CRGB(0,0,0);

leds[7] = CRGB(0,0,0);

leds[8] = CRGB(0,0,0);

leds[9] = CRGB(0,0,0);

leds[10] = CRGB(0,0,0);

leds[11] = CRGB(0,0,0);

leds[12] = CRGB(0,0,0);

leds[13] = CRGB(0,0,0);

leds[14] = CRGB(0,0,0);

leds[15] = CRGB(0,0,0);

leds[16] = CRGB(0,0,0);

leds[17] = CRGB(0,0,0);

FastLED.show();

delay (time1);

}

If you want the same effect at the same time, use just one pin to control both strips.

If you want diverse effects on both strips, running at the same time then the code gets more complicated and you’d probably be better off investing time in mastering programming and Using millis() for timing. and doing Several things at the same time

1 Like

Ya know, I didn't even attempt to simply use the same data pin because I didn't think it would be that simple....but it was, and I thank you!

Also, thanks for sharing the resources. I will definitely take a look.

Great - enjoy!

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