In the following code I get an error:
sketch_mar25a:26:46: error: assignment of function 'TestClass xxxMe()'
if (ESP.getChipId() == xxxA.chipId) {xxxMe = xxxA; return;}
^
sketch_mar25a:26:46: error: cannot convert 'TestClass' to 'TestClass()' in assignment
How do I get xxxMe to be set to one of the four other values of the class?
class TestClass{
public:
int chipId;
int loopNum;
int loopCnt;
int blockNum;
TestClass() {}
TestClass(int loopNumber, int loopCount, int blockNumber )
{
chipId = ((loopNumber*256)+loopCount)*256+blockNumber;
loopNum = loopNumber;
loopCnt = loopCount;
blockNum = blockNumber;
}
};
TestClass xxxMe();
TestClass xxxA(0, 4, 0);
TestClass xxxB(0, 4, 1);
TestClass xxxC(0, 4, 2);
TestClass xxxD(0, 4, 3);
void setup() {
// put your setup code here, to run once:
if (ESP.getChipId() == xxxA.chipId) {xxxMe = xxxA; return;}
if (ESP.getChipId() == xxxB.chipId) {xxxMe = xxxB; return;}
if (ESP.getChipId() == xxxC.chipId) {xxxMe = xxxC; return;}
if (ESP.getChipId() == xxxD.chipId) {xxxMe = xxxD; return;}
}
void loop() {
// put your main code here, to run repeatedly:
}