Code:
class RemoteController
{
public:
static const int numKey[];
static const int controlKey[];
boolean isKeyFound;
int getNumKeyPressed(int);
};
static const int RemoteController::numKey[10] = { 0xFF4AB5, 0xFF6897, 0xFF9867, 0xFFB04F
,0xFF30CF, 0xFF18E7, 0xFF7A85, 0xFF10EF
,0xFF38C7, 0xFF5AA5
};
static const int RemoteController::controlKey[5] = { 0xFF629D, 0xFFA857, 0xFFC23D , 0xFF22DD,
0xFF02FD
};
int RemoteController::getNumKeyPressed(int keyPressed)
{
isKeyFound = 0;
for( int i = 0; i < 10; i++){
if( /*results.value*/ keyPressed == numKey[i])
{
isKeyFound = true;
Serial.println("Key found");
return i;
}
}
if( isKeyFound = false)
Serial.println("Couldn't find the key, wrong key pressed!");
}
I get error : "'static' may not be used when defining (as opposed to declaring) a static data member [-fpermissive]"
What is the right way of assigning values to a array field?
This is just the part of my microcontroller code that is why there is no main function.