I have copied a code for an irrigation timer from a tutorial called "Getting started with Arduino".It uses a while else if loop and arrays to do the switching.when I verify the code, I get an error "expected unqualified id before switch" the highlighted code reads " for(int switch=0;switch<NUMBEROFSWITCHES;switch++)
Ican not figure out what the error means. Can somebody please give me some pointers.
I am very new at this game.
Thanks
In the FULL message (in that box of text below your sketch) it has more details. If you could copy the full message and any related messages (about nearby lines) that would help, too.
GOOD POINT!
Unfortunately, even the PILE of error messages that mistake generates doesn't spell out the source of the problem. The coloring of keywords helps a bit but so many things are colored so many ways it is hard to notice when something has a color that is 'unexpected'.
/Users/john/Documents/Arduino/sketch_jul29a/sketch_jul29a.ino: In function 'void setup()':
sketch_jul29a:4:12: error: expected unqualified-id before 'switch'
for (int switch = 0; switch < NUMBEROFSWITCHES; switch ++)
^~~~~~
sketch_jul29a:4:12: error: expected ';' before 'switch'
sketch_jul29a:4:12: error: expected primary-expression before 'switch'
sketch_jul29a:4:12: error: expected ';' before 'switch'
sketch_jul29a:4:12: error: expected primary-expression before 'switch'
sketch_jul29a:4:12: error: expected ')' before 'switch'
sketch_jul29a:4:19: error: expected '(' before '=' token
for (int switch = 0; switch < NUMBEROFSWITCHES; switch ++)
^
sketch_jul29a:4:31: error: expected '(' before '<' token
for (int switch = 0; switch < NUMBEROFSWITCHES; switch ++)
^
sketch_jul29a:4:58: error: expected '(' before '++' token
for (int switch = 0; switch < NUMBEROFSWITCHES; switch ++)
^~
exit status 1
expected unqualified-id before 'switch'