I recently downloaded this program and have been testing a few programs that I have written, however the program doesn't like switch statements I get this error
" Mistake while reading the program: switch(## isn't known! "
First I thought it might be the program I had written however I then tested an earlier version of the program (a very basic sumo bot program with only line detection) that worked on the actual hardware in university and it gives me the same error.
This is the basic program that's not working.
int state = 0 ; // 0 = roam 1= right avoid 2= left avoid
case 0 :
if ( Sensor(IN_3)!= 1)
state = 2;
if ( Sensor(IN_2)!= 1)
state = 1;
state = 0;
state = 0;
Im using nxceditor 0.1.1
Any help is much appreciated.
Just as a side note the program compiles fine its only the emulator that doesn't like it.
I wrote the nxcSimulator for my students. Since this is a program for beginners, not all NXC commands are included. There is a list of all commands that one can use inside the nxcSimulator (nxcSimulator: "Help" -> "show commands for the simulator" - "switch … case" is not included). I will add further orders to the nxcSimulator, if I need them in the classroom (or if I have boredom).
By the way:
The nxcSimulator checks whether or not he knows certain commands when the program starts. "Mistake while reading the program: switch (# # is not known" is the output of the nxcSimulator.
Thanks for getting back to me so quickly.
Its a shame to hear that because this is one of the best linux nxc programs I have found.
Hope your class enjoy using it and that you keep on developing it, it would be amazing to one day see a full emulator.
... now "switch ... case" is added to the simulator and some other commands (for-loop, one-dimensional array works without ArrayInit, function calls ... return, NumOut and TextOut with coordinate values (multiples of 6 and 8), ... ).
If you are missing something in the simulator or editor: In the forum "Open Discussion" there is a "wish list".