The code below compiles fine on Arduino (I don’t know how to make them show up here, but there are in fact MULTIPLE spaces between “switch” and the opening bracket of the switch variable). But, on Sparkcore web interface, unless you reduce the spaces to just one, you get a compiler error.
Yep, pretty stoopid to have junk spaces there, but it could happen (as in my case) inadvertently and I would have thought that (like the Arduino compiler) it shouldn’t matter? Problem is, the Spark compiler error message mentions bad characters “before switch”, so I wasted quite a long time looking at the code preceding the switch-case.
Is this a repeatable problem, or something specific to my set-up?
Thanks as ever
Best
Alan T,.
=======
char inBuff[20];
void setup()
{
}
void loop()
{
switch (inBuff[0])
{
case 'a':
// Do something if 1st char was 'a'
break;
default:
// Do something else if it wasn't.
break;
}
}