ROBOTC.net forums
http://robotc.net/forums/

Wait For Start Command
http://robotc.net/forums/viewtopic.php?f=52&t=7435
Page 1 of 1

Author:  aaronmk1 [ Tue Dec 10, 2013 2:11 pm ]
Post subject:  Wait For Start Command

We tried to compile our autonomous programs, but robotC gives us an error saying undefined procedure. The problem is with the "waitForStart();" command. We type it exactly like that and doesn't work. Any ideas of what the problem is?

Author:  JohnWatson [ Tue Dec 10, 2013 2:43 pm ]
Post subject:  Re: Wait For Start Command

Can you post your code using the [code] tags? This will help us determine what the root cause of this issue is.

There are a couple common causes of this issue that you can check in the meantime. First, check to make sure that your Platform Type (under the Robot menu) in ROBOTC is set to LEGO NXT + TETRIX/MATRIX and not just LEGO MINDSTORMS NXT.

Next, check to make sure that the 'Compiler Target' (also under the Robot menu) is set to 'Physical Robot' and not 'PC-Based Emulator' (if applicable).

Please let us know if either of these solve the issue for you, and if not, please make sure to post your code (using the [code] tags) and we will be more than happy to assist you further.

Author:  aaronmk1 [ Tue Dec 10, 2013 4:12 pm ]
Post subject:  Re: Wait For Start Command

What do you mean "code tags"? And yes, all the other settings are correct as you stated.

Author:  MHTS [ Tue Dec 10, 2013 4:17 pm ]
Post subject:  Re: Wait For Start Command

When you reply the post, there is a "button" that says "Code". If you click that it will generate a code tag in your reply. If you put your code in between these code tags, the indentation will be preserved.

Author:  aaronmk1 [ Tue Dec 10, 2013 4:35 pm ]
Post subject:  Re: Wait For Start Command

Thank you, I will post my code before 5 today.

Author:  aaronmk1 [ Tue Dec 10, 2013 6:12 pm ]
Post subject:  Re: Wait For Start Command

Here is the code. (Above the const int's is the motor and sensor setup code)

Code:
const int servostart = 35;
const int servoend = 235;

void initializeRobot()
{
   return;
}

task main()
{
   initializeRobot();
   waitForStart();

   servo(auto) = servostart;
   ClearTimer(T1);

   while(true)
   {
      motor[leftmotor] = 50;
      motor[rightmotor] = 50;
      wait10Msec(300);
      servo[auto] = servoend;
      servo[auto] = servostart
   }
}

Author:  MHTS [ Tue Dec 10, 2013 6:50 pm ]
Post subject:  Re: Wait For Start Command

The waitForStart() function is defined in JoystickDriver.c. So you need to include it. Please put the following line at the top of your program but underneath the pragmas.
Code:
#include "JoystickDriver.c"

Author:  aaronmk1 [ Tue Dec 10, 2013 9:21 pm ]
Post subject:  Re: Wait For Start Command

Thank You so much!!!
This works perfectly now.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/