Store.ino: In function 'void loop()':
Store:36: error: case label does not reduce to an integer constant
Store:41: error: case label does not reduce to an integer constant
Store:46: error: case label does not reduce to an integer constant
Store:51: error: case label does not reduce to an integer constant
Store:56: error: case label does not reduce to an integer constant
Store:61: error: case label does not reduce to an integer constant
Store:66: error: case label does not reduce to an integer constant
Store:72: error: case label does not reduce to an integer constant
Store:77: error: case label does not reduce to an integer constant
Store:82: error: case label does not reduce to an integer constant
Store:87: error: case label does not reduce to an integer constant
Store:92: error: case label does not reduce to an integer constant
Store:97: error: case label does not reduce to an integer constant
Store:102: error: case label does not reduce to an integer constant
Store:107: error: case label does not reduce to an integer constant
Store:112: error: case label does not reduce to an integer constant
Store:117: error: case label does not reduce to an integer constant
Store:122: error: case label does not reduce to an integer constant
Store:127: error: case label does not reduce to an integer constant
Store:132: error: case label does not reduce to an integer constant
Store:137: error: case label does not reduce to an integer constant
Store:142: error: case label does not reduce to an integer constant
Store:147: error: case label does not reduce to an integer constant
case label does not reduce to an integer constant
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
'rack' is a variable capable of holding a single character, so only will contain T or O or P (for your example).
The switch statement will only work with a numeric variable (1, 2, 'a', 'b' etc).
So for top, you can simply send a 'T'
switch(rack)
{
case 'T':
...
...
break;
}
I would start reading Robin2's Serial Input Basics - updated if you want to make it more complicated than single character. You can make use of strcmp in combination with if / else if
// make sure rack is large enough to hold your largets message plus one additional character
char rack[10];
//read characters into rack variable; up to you
...
...
// check and take action
if(strcmp(rack, "TOP") == 0)
{
...
...
}
else if(strcmp(rack, "BOTTOM") == 0)
{
...
...
}
else if
etc
etc
etc
No matter how much you want to do it that way you CAN'T use a string in a switch statement in C, get over it an move on. I wanted to be an astronaut, I couldn't so I got over it, you need to do the same and find some valid C code to do what you want.
Either compromise and use a single character like 'T', or use the strcmp() function in an if{} as noted above.
Even if you could use a string like "TOP" you are only reading a single character, but you can't so forget I mentioned that.