Hi all,
I'm new on arduino programming.
Here is my first sketch. I'm having the mentioned error when I try to compile the code.
Why this error occurs since, looking at the cases, they are all different???? Could anyone help me, please???
Please find attached, the source sketch.
Thanks alot in advance.
Gilberto.
char state=1; // variável que guarda posição atual do menu
A "char" can hold values in the range -128 to +127.
case 31111: // executado quando na TELA 31111
...
case 3112: // executado quando na TELA 3112
...
case 31121: // executado quando na TELA 31121
...
case 311211: // executado quando na TELA 311211
Thanks for your interest and help Nick,
When I delete the case 32211 and respective break, there are no more errors (Please, try it on your computer). Looks like the problem is only with the case number 32211.
How could I declare it instead char????
Thanks in advance.
Gilberto.
Thank you very,very,very much CrossRoads and Nick. Looks like the unsigned int solved the problem. I will try with the other case numbers that were with this problem.
Best Regards,
Gilberto.
The problem is that the hard coded values are "trimmed" upon a char type.
In practice that means only the last byte of the numbers is used. (convert the numbers to hexadecimal - Serial.println(nr, HEX) - to see the last byte)
gibalbp:
Thank you very,very,very much CrossRoads and Nick. Looks like the unsigned int solved the problem. I will try with the other case numbers that were with this problem.
case 311211: // executado quando na TELA 311211
311211 won't fit into an unsigned int.
Better look up data types and what ranges they hold. Unsigned int holds from 0 to 65535 on this platform.