the following program worked fine with my former NXC releases - now I unexpectedly get a compile error:
what's wrong suddenly?# Error: Too many arguments
File "c:\Temp\temp.nxc" ; line 31, position 30
# Wait( 200+ (Random(2800) );
#----------------------------------------------------------
# Error: ")" expected
File "c:\Temp\temp.nxc" ; line 31, position 30
# Wait( 200+ (Random(2800) );
#----------------------------------------------------------
Has the early 2013 (February) NXC compiler been corrupted when copying the 2013-October release into the BCC folder?
Code: Select all
// Multitasking-Demo:
// 3 Motoren an die Motorausgänge A,B,C anschließen !
// die Motoren werden automatisch angesteuert,
// die Encoderwerte werden simultan angezeigt!
#define clreol DRAW_OPT_CLEAR_EOL
task DisplayValues() {
while(true) {
TextOut(0,56, "Enc.A:", clreol); NumOut(42,56, MotorRotationCount(OUT_A));
TextOut(0,48, "Enc.B:", clreol); NumOut(42,48, MotorRotationCount(OUT_B));
TextOut(0,40, "Enc.C:", clreol); NumOut(42,40, MotorRotationCount(OUT_C));
Wait(10);
}
}
task MotorControl() {
int speed;
while(true) {
speed=Random(201) - 100; // ergibt eine Zufallszahl für die Motorleistung zwischen -100 und +100
OnFwd(OUT_A,speed);
speed=Random(201) - 100;
OnFwd(OUT_B,speed);
speed=Random(201) - 100;
OnFwd(OUT_C,speed);
Wait( 200+ (Random(2800) ); // ergibt eine Zufallszahl für die Aktionsdauer von 200 - 3000 ms
}
}
task main() {
start DisplayValues;
start MotorControl;
while(true);
}