I have been having this error when I reprogrammed my robot: Error:Undefined variable ‘bStopTasksBetweenModes’. ‘short’ assumed.
Is there anyway to fix it and should I be concerned?
Hi Ryan205,
Unfortunately I am not sure whats causing such error message.
Do you get the message when downloading sample programs as well?
Can you please attach a screenshot of the error message?
-Eli
Here is a picture of the error.
[ATTACH]8775[/ATTACH]
And when I try to download sample programs, it says No communications link available to VEX device.
The bStopTasksBetweenModes boolean flag is used to allow or restrict user-created tasks from running in between the pre-auton, autonomous, and user-control phases of a VRC match. This is built into the ‘Vex_Competion_Includes.c’ include file that is included in the Competition Template in ROBOTC.
Usually when we see this issue, it is because the Vex_Competition_Includes.c file is not included in the user program properly. To check for this, please paste the entirety of your code (or, preferably, a smaller program that can cause this issue) as a response to this post by using the
tags.
Here is the code:
#pragma platform(VEX)
//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!
/////////////////////////////////////////////////////////////////////////////////////////
//
// Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////
void pre_auton()
{
// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
bStopTasksBetweenModes = true;
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////
task autonomous()
{
// .....................................................................................
// Insert user code here.
// .....................................................................................
// Remove this function call once you have "real" code.
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// User Control Task
//
// This task is used to control your robot during the user control phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////
task usercontrol()
{while(true)
motor[10] = vexRT(Ch2);
motor[6] = vexRT(Ch3);
//Arm lift
if (vexRT[Btn5U] == 1)
{
motor[port4] = 127;
motor[port2] = 127;
motor[port3] = 127;
motor[port5] = 127;
}
else if (vexRT[Btn5D] == 1)
{
motor[port4] = -127;
motor[port2] = -127;
motor[port3] = -127;
motor[port5] = -127;
}
else
{
motor[port4] = 0;
motor[port2] = 0;
motor[port3] = 0;
motor[port5] = 0;
}
if (vexRT[Btn6U] == 1)
{
motor[port7] = -40;
motor[port8] = -40;
}
else if (vexRT[Btn6D] == 1)
{
motor[port7] = 40;
motor[port8] = 40;
}
else
{
motor[port7] = 0;
motor[port8] = 0;
}
}