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. I’m using an Uno r3 with Arduino 1.6 connecting into a DMX receiver.
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:
Code: [Select]
#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).