When I do that without any initial assignment, I get the error: “candidate expects 1 argument, 0 provided
no matching function for call to ‘CPixelView::CPixelView()’”
If I do initial assignment like:
CRGBSet rgbSetArray[2] [ {setOne, setTwo};
reassignment (rgbSetArray[1] = setTwo) does not work correctly. rgbSetArray[1] is still setTwo after trying that.
@Joe_Meissler I don’t remember my C++ that well - but have you tried to create an array of pointers instead. That would probably be more efficient as well.
@Dushyant_Ahuja just gave your code a try. The array assignment works, but fill_solid(*toLight[i],2,color); only lights up 2 LEDs at a time. Having that number be dynamic would be tricky. However, *toLight[i] = color; works just fine. Thanks for all the help.
I find this interesting, as this is something I was working on related to my project. I have to work with multiple led objects that are effectively diamond layouts (they are computer fans, mind you) and I needed to be able to address the fans individually and segments of each fan individually. As a result, I ended up with a multidimensional array of pointers to CRGBSets that I was able to set up in loops and can address in loops. This applies here too…
A short set of some examples:
//Global
CRGBSet *set[2];
//In setup()
set[0] = new CRGBSet( leds(0,10) );
set[1] = new CRGBSet( leds(11,20) );
//In place of any case of setOne(start,end)
//use set[0]>operator()(start,end) set[0]>operator()(0,2) = CRGB::Green;
set[0]->operator()(3,5).fill_rainbow(hue++);
//In place of setTwo[n]
//use (*set[1])[n]
(*set[1])[3] = CRGB::Blue;
It works fine with multidimensional arrays of pointers too.