Quick question (I hope) about how to store FastLed value in Array I'm creating

Quick question (I hope) about how to store FastLed value in Array

I’m creating this function that blends two complimentary colors together and then I cycle thru a bunch of sets of 2 color. To do that I need to store the currently blended color. I’m having trouble storing the CRGB value to the structured array and cannot figure out the format to do that successfully. Below is a portion of my sketch:

--------------------------------

void blendColors() { //blends between 2 complimentary colors randomly
blendAmount = 0;
CurrentLED = random(NUM_LEDS); // sets one of 9 leds to randomly blend
if (LEDchannelinfo[CurrentLED].toggle == 0 ) { // blend color A to color B
for ( int i = 0; i < 256; i++ ) { //coordinated with the 255 blend range
blendcolor = blend(LEDchannelinfo[CurrentLED].currentcolorA, LEDchannelinfo[CurrentLED].colorB, blendAmount);
leds[CurrentLED] = blendcolor;
FastLED.show();
blendAmount++;
FastLED.delay(blendspeed); // delays loop for blend speed
}
LEDchannelinfo[CurrentLED].toggle = 1;
LEDchannelinfo[CurrentLED].currentcolorB = blendcolor; //stores current B color for next blending loop need to know how to write current value correctly**
}
else if ( LEDchannelinfo[CurrentLED].toggle == 1 ) { // blend color B to color A
for ( int i = 0; i < 256; i++ ) { //coordinated with the 255 blend range
blendcolor = blend(LEDchannelinfo[CurrentLED].currentcolorB, LEDchannelinfo[CurrentLED].colorA, blendAmount);
leds[CurrentLED] = blendcolor;
FastLED.show();
blendAmount++;
FastLED.delay(blendspeed); // delays loop for blend speed
}
LEDchannelinfo[CurrentLED].toggle = 0;
LEDchannelinfo[CurrentLED].currentcolorA = blendcolor; //stores current A color for next blending loop
}

----------------------------------------

So my question centers around the line in my sketch. If I store the CRGB value using a predefine color from the FastLED library it works:

LEDchannelinfo[CurrentLED].currentcolorA = CRGB::Orange;

But it doesn’t work if I try to store the current “blendcolor” to the array. It seems to store it as a “0” :

LEDchannelinfo[CurrentLED].currentcolorA = blendcolor;

What must I do with the variable blendcolor (which is the current CRGB value) to get it to store in the structured array? BTW, here is the Structured Array:

------------------------------------------
typedef struct
{
int toggle; //stores current Toggle to go between A>B or B<A
int colorA; //assigned complimentary color A
int colorB; //assigned complimentary color A
int currentcolorA; //stores last value of current A color
int currentcolorB; //stores last value of current B color
} record_type;
record_type LEDchannelinfo[NUM_LEDS];

-------------------------------------------

Thanks in advance

Mark

At the top of your code do you have ‘blendcolor’ defined? If not add:

CRGB blendcolor;

Here’s an example that has some CHSV variables created at the top of the program. CRGB could also be used depending on what you want to work with.

@Mike_Katchmar +
Hi Mike,
Yes I do.

missing/deleted image from Google+

@marmil
Yes, I’m familiar with those examples but I’m still at a loss as to how to assign my CRGB value to the array. I believe that there is something that I need to do to format it correctly so that it can be used again for the Blend statement. Again, the first example below works (stores the value in the array to be use again successfully) , the second does not:

LEDchannelinfo[CurrentLED].currentcolorA = CRGB::Orange;

LEDchannelinfo[CurrentLED].currentcolorA = blendcolor;

Here is a link to the entire sketch:

https://app.box.com/s/hppwzyt1vzg890nbllt9ua5ezblf1e2h

@Mark_Biasotti1 Can you use http://gist.github.com to share you code? It doesn’t require a login, doesn’t want to feed me a zip file, and would be much easier to view on mobile. Also, line numbers can be referenced for discussion. (I can’t view your current shared link.)

Sorry about that, BOX was down for maintenance and the link temporary not working here is the link to BOX that works:

https://app.box.com/s/hppwzyt1vzg890nbllt9ua5ezblf1e2h