I have the following code (stripped down for simplicity) which is using Aaron Liddiment's LED libraries:
#include <FastLED.h>
#include <LEDMatrix.h>
#include <LEDSprites.h>
#include <LEDText.h>
cLEDMatrix<16, 16, HORIZONTAL_ZIGZAG_MATRIX> leds;
class Class2{
public:
Class2(){
init();
};
void init(){
cLEDSprites Sprites(&leds);
}
bool loop(){
Sprites.UpdateSprites();
return true;
}
};
I need to refer to the Sprites object in Class2::loop() as shown, but I'm told that 'Sprites' was not declared in this scope (which makes sense). If I move this line outside of the init function as follows:
class Class2{
cLEDSprites Sprites(&leds);
public:
Class2(){};
bool loop(){
Sprites.UpdateSprites();
}
};
I then get error: expected identifier before '&' token.
If Sprites was an int, I would declare a private attribute in Class2, pass the value into the class through the constructor and copy it over in the init function. I don't know how to do that with something of type cLEDSprites. As you can tell I'm quite new to all this stuff so please be gentle with my ignorance!