Will_Fraga
(Will Fraga)
September 15, 2016, 11:17pm
1
Hello,
Thanks Daniel and Mark
I’m trying to make a palette where i need move the distance between to colors:
Like :
for( i=60,i<160,i++){
DEFINE_GRADIENT_PALETTE( myPalette ) {
0, 32, 32, 32,
i, 0, 0, 0,
200,32,32,32 }
}
I know this is a wrong code, because is a DEFINE, i want to make a Gradiente palette, on the fly Is possible ? ( this code is only to show what i need…)
thanks in advance
Jeff_Hannan
(Jeff Hannan)
September 15, 2016, 11:31pm
2
I wrote this function that does a little bit of what you are after- see if you can adapt this-
CRGBPalette16 getPaletteMatrix(CRGB color) {
static byte gradientByte[12] = {
0, 0, 0, 0, //black
192, 0,255, 0, //green
255, 255,255,255}; //white
gradientByte[5] = color.r;
gradientByte[6] = color.g;
gradientByte[7] = color.b;
CRGBPalette16 returnPalette;
returnPalette.loadDynamicGradientPalette(gradientByte);
return returnPalette;
}
Will_Fraga
(Will Fraga)
September 16, 2016, 12:55am
3
Thanks Heff, but need return/get the exactly format of DEFINE_GRADIENT_PALETTE
you are return a ( CRGBPalette16 )
but i saw the result of ( DEFINE_GRADIENT_PALETTE ) is another type
do you know about ?
Jeff_Hannan
(Jeff Hannan)
September 16, 2016, 10:57pm
4
This is probably closer to what you want-
for(int i = 0; i < 160; i++) {
//set up gradient
static byte gradientByte[12] = {
0, 32, 32, 32,
i, 0, 255, 0,
200, 32, 32, 32};
//load gradient into myPalette
myPalette.loadDynamicGradientPalette(gradientByte);
}
Good luck!
yosef18
(yosef18)
September 18, 2016, 10:54pm
5
Hi Jeff, i will do test, but looks like is the solution…
soon i back to tell you
thank you