Hi, does anyone have any examples of how to implement multiple palettes?  I have

fastled-support
gplus
(Anthony Ollerton) #1

Hi, does anyone have any examples of how to implement multiple palettes?
I have modified the noise plus palette example so I can apply it to strips individually using

void mapNoiseToLEDsUsingPalette(int start , int range)

is it possible to also specify which palette to use?
for example if they were defined as currentpalette1,currentpalette2 etc

Thanks
Anthony

full code
https://codebender.cc/sketch:91941

(Jon Burroughs) #2
(Anthony Ollerton) #3

Thanks, Yea thats what i started with.
i modified it to use 1d noise, then (with some inspiration form marks multiple pattern example) modified it so i could assign different patterns to each strip.
I am now struggling with finding a way of assigning different palettes to each pattern.

(Randal B) #4

this is one way to multitask the different sections.

I’ve done it with the same setup, 1 array-many strips no problem… but i ended up moving to many array-many strips.

my first hack code is here, which may give you some insight on how i made it work for FastLED
http://pastebin.com/QB8fUSdF

For one array-manystrips i had something like this instead
class TreePatterns
{
public:
//Common variables for each string. Let us use the same effect code for each string even though they are different pixels, colors, lengths, etcetc.

int Row;
int LedIndex; //first pixel
int LedEndIndex; //last pixel
int TotalSteps; // number of leds
CRGBPallette Pallette1;

TreePatterns(int row) //define for each string
{
switch(row)
{
case1:
LedIndex = start1;
LedEndIndex = start2-1;
Totalsteps = range1;
break;
case2:
LedIndex = start2;
LedEndIndex = start3-1;
Totalsteps = range2;

}
}

void Update()
{
//update stuff
}

void Effect(CRGBPallete inputpallet)
{
// Set variables for effect
Pallet1 = inputpallet;
}

void EffectUpdate()
{
//do fun stuff
for (i = Index; i < LedEndIndex; i++) { }
leds[i]… ;
}

//setup strings
TreePatterns String(1)
TreePatterns String(2)

setup()
{
FastLED.addleds…
}

loop()
{
String1.Update();
String2.Update();

}

i digress. Not sure how this will play with the noise setup but hope it helps.

(Anthony Ollerton) #5

thanks @Randal_B , it all looks useful. just looking though it all now.

(Anthony Ollerton) #6

Thats done it! the code above had the answer i was looking for .
Changed
void mapNoiseToLEDsUsingPalette(int start , int range)
to
void mapNoiseToLEDsUsingPalette(CRGBPalette16 palette , int start , int range)

Reading all that has however got me wondering if i could organise it all better.