Hi everyone, i've got a trouble setting up 2 fastled arrays on the same

fastled-support
gplus
(Xavier Giménez) #1

Hi everyone, i’ve got a trouble setting up 2 fastled arrays on the same pinout. Is it possible to split a strip of 20 leds using the same data/clock, in two fastled arrays?

Thanks
Pd: something like:
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, GBR>(leds, NUM_LEDS);
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, GBR>(leds2, 11, NUM_LEDS);

(Mark Kriegsman) #2

Do you mean you have one strip of LEDs that you want to program as two arrays? If so:

#define NUM_LEDS_1 20
#define NUM_LEDS_2 20
#define NUM_LEDS_BOTH (NUM_LEDS_1 + NUM_LEDS_2)

CRGB ledsBoth[NUM_LEDS_BOTH];
CRGB ledsPart1 = ledsBoth + 0;
CRGB ledsPart2 = ledsBoth + NUM_LEDS_1;

Then just do an addLeds for the ‘both’ array, once. Then you can program like this:

leds1[blah] = whatever;

leds2[other] = something else;

FastLED.show();

Like that?

(Xavier Giménez) #3

Sounds really promising, I think it’s exactly the solution you pointed!!!
althought i tried and it gives an error with (fastled 3.1) “CRGB leds1 = ledsBoth + 0;” ->

test:12: error: invalid conversion from ‘CRGB*’ to ‘uint32_t’
test:12: error: initializing argument 1 of ‘CRGB::CRGB(uint32_t)’

using a code like the one you said:

#include “FastLED.h”

#define NUM_LEDS_1 24
#define NUM_LEDS_2 24
#define NUM_LEDS_BOTH (NUM_LEDS_1 + NUM_LEDS_2)

CRGB ledsBoth[NUM_LEDS_BOTH];
CRGB leds1 = ledsBoth + 0;
CRGB leds2 = ledsBoth + NUM_LEDS_1;

setup{

FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, GBR>(ledsBoth, NUM_LEDS_BOTH);
LEDS.setBrightness(50);

}

(Mark Kriegsman) #4

Try just leds1 = bothLeds;

(Xavier Giménez) #5

tried and still the same compilation error… could be the 3.1?

(Mark Kriegsman) #6

Sorry, my bad. Those CRGB should be CRGB*.

(Mark Kriegsman) #7

For the declarations of leds1 and leds2.

(Xavier Giménez) #8

Yes!!! AWESOME SUPPORT MARK! Thank you very much for your help!!! I’ve been a couple of days trying to figure it out using odd arrays and stuff… and now back on track!

Really glad to be on this community and using your impressive code!

Thanks

pd… looking forward this stm32 support… that seems to be next gamechanger paired with esp8266

(Xavier Giménez) #9

pd… google+ should have a button on left menu side of fastleds for a beerware license donation :wink:

(Matt) #10

@Mark_Kriegsman I know this is super old but why is it " CRGB ledsPart2 = ledsBoth + NUM_LEDS_1;" wouldn’t that be 60?