Errors in passing FastLED color pointers to functions

Hi there,

I'm trying to implement a display that houses 4 nested led strips and use an arduino to create a few animation effects. The issue I'm having is in trying to call different functions and passing through pointers to FastLED color structs.

Here is the most basic of cases. Within an animation, I aim to blend two colors in a slow progression. The loop calls the colorBlend function to update LED strip's color once that is done, it send the instructions out to the strip through DMX. Here's the code:

#include <FastLED.h>
#include <DmxMaster.h>

#define numStrips 4
int step = 128;
int led1Strip = 0;
int channelArray[numStrips][3];

CRGB strip1Color;  //empty container that gets updated each time with new blend color

CHSV baseColor = CHSV(45, 98, 95);
CHSV newColor = CHSV(208, 98, 55);

void setup() {
  pinMode(dmxPin, OUTPUT);
  DmxMaster.usePin(3);
  DmxMaster.maxChannel(12);
}

void loop() {
  // this function call is housed in a loop that steps through the blend, but only the call is important
  colorBlend(&strip1Color, &baseColor, &newColor, step);
  sendDMX(led1Strip, &strip1Color);

}

void colorBlend(struct CRGB *arrToChange[], struct CHSV *color1[], struct CHSV *color2[], int perc) {
   arrToChange = blend(color1, color2, perc);  //the blend funciton from FastLED
}

void sendDMX(int theStrip, struct CRGB *theColor) {
  for(int z=0; z<3; z++) {   //loop to send instructions to each of 3 channels, one for R, G, & B
    DmxMaster.write(channelArray[theStrip][z], theColor[z]);
  }
}

From this I get a number of errors stemming from passing the pointers:

  • cannot convert 'CRGB*' to 'CRGB**' for argument '1' to 'void colorBlend(CRGB**, CHSV**, CHSV**, int)'
  • invalid user-defined conversion from 'CHSV**' to 'const CRGB&' [-fpermissive]
  • candidate is: CRGB::CRGB(uint32_t)
  • no known conversion for argument 1 from 'CHSV**' to 'uint32_t {aka long unsigned int}'

Any help would be greatly appreciated. I'm still unsure about how to use pointers properly. My intent is to pass the pointers to the 'strip1Color' struct (I believe it is a struct) which gets updated with a blended color between two other colors structs (baseColor & newColor), the pointers to which have also been passed with a value with the point to blend between the two colors (step: between 0-255).

I'm not well versed on pointers but,

  1. I think the issue is that you are working with both chsv and CRGB classes within fast led. These are different classes, and aren't automatically converted. It seems you are trying to fill a CRGB struct with CHSV values Stick with CRGB or CHSV. Alternatively, there is a function that will convert CRGB to CHSV.

  2. FastLED Google plus group is very active and you would probably get more help there
    https://plus.google.com/communities/109127054924227823508?gtuid=112709672046334148759

I've tested interchanging CHSV with CRGB and there are no issues. I can plug a CHSV color into the blend() function without issue. Something like this works fine:

blendedColor = blend(CHSVcolor1, CHSVcolor2, step)
where blended Color is a CRGB struct

It really does seem to be the pointers. Thanks for the tip on the Google+ group. I'll try there.