Hi, i have a projet i'm doing some modification in the code and I'm not a big C++ programmer (more java and vb)
I currently have a switch case statement that is working great. Exemple:
switch (buf[0]){
case 'A':
//do something
break;
case 'B':
//do something
break;
}
The 'A' and 'B' change value depending of the project and wish to use a variable (global at the top of the code) to store those value because there is a lot of place to edit when programming another arduino, and often forgot some.
So I try this
char controllerID_1 = 'A';
char controllerID_2 = 'B';
...
switch (buf[0]){
case controllerID_1:
//do something
break;
case controllerID_2:
//do something
break;
}
And I got this error:
error: 'controllerID_1' cannot appear in a constant-expression
Is there a way to do what I want in a Switch statement or I will need to do some If Else Statement ?