FastLed Using two different Strips of Neopixles with Different numbers of LED's

Hi,

Using a modified FastLED Library example "ArrayOfLedArrays" I am trying to write to two totally separate Neopixle strips which are connected to two different I/O pins on the arduino and contain different numbers of LED's 108 and 180 respectively.

I keep hitting compile errors (the latest one shown below) which ever way I try to write the sketch.

Any guidance with where I am going wrong would be much appreciated, I would also like to write to the LEDS in parallel, i.e. not do a for loop for one set and then a separate for loop for the second set ?

// ArrayOfLedArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
// using multiple controllers.  In this example, we're going to set up three NEOPIXEL strips on three
// different pins, each strip getting its own CRGB array to be played with, only this time they're going
// to be all parts of an array of arrays.

#include <FastLED.h>

#define NUM_STRIPS 2
#define NUM_LEDS_PER_STRIP1 108
#define NUM_LEDS_PER_STRIP2 180
CRGB leds[0][NUM_LEDS_PER_STRIP1];
CRGB leds[1][NUM_LEDS_PER_STRIP2];

// For mirroring strips, all the "special" stuff happens just in setup.  We
// just addLeds multiple times, once for each strip
void setup() {
  // tell FastLED there's 108 NEOPIXEL leds on pin A0
  FastLED.addLeds<NEOPIXEL, A0>(leds[0], 108);

  // tell FastLED there's 180 NEOPIXEL leds on pin 6
  FastLED.addLeds<NEOPIXEL, 6>(leds[1], 180);

}

void loop() {
  // This loop will go over each led in strip1, one at a time
  for (int i = 0; i < NUM_LEDS_PER_STRIP1; i++) {
    leds[0][i] = CRGB::Red;
    FastLED.show();
    leds[0][i] = CRGB::Black;
    delay(100);
  }
  // This loop will go over each led in strip2, one at a time
  for (int n = 0; n < NUM_LEDS_PER_STRIP2; n++) {
    leds[1][n] = CRGB::Red;
    FastLED.show();
    leds[1][n] = CRGB::Black;
    delay(100);
  }
}

Gives the following compile error ? ...

CRGB leds[0][NUM_LEDS_PER_STRIP1];
      ^~~~
exit status 1
conflicting declaration 'CRGB leds [1][180]'
CRGB leds[0][NUM_LEDS_PER_STRIP1];
CRGB leds[1][NUM_LEDS_PER_STRIP2];

You cannot have 2 arrays withe the same name

CRGB leds1[NUM_LEDS_PER_STRIP1];
CRGB leds2[NUM_LEDS_PER_STRIP2];

then use leds1 and leds2 to refer to the separate strips in the code

Thanks UKHeliBob, I see what you mean now, I will give your solution a try.

Regards,

Fimez.

Solved, thanks UKHeliBob, so simple.

Regards,

Fimez.

// The array of Track LEDs
CRGB trackleds[num_Leds_Tracks];
// The array of Background Illumination LEDs
CRGB backleds[num_Leds_Back];

I'm glad you got it working

I think that one reason people go wrong is that the LED array in the examples is named leds which, while quite logical, can obscure the fact that it (they) can be named anything, as you have seen. Once you realise that then it is easy to see how to drive two or more strips with different lengths because they are different objects