(More) Code Trouble

Hi,

I’m getting the following warnings in my code:


*Warning*:Unreferenced function 'pre_auton'
*Warning*:Unreferenced task 'autonomous'
*Warning*:Unreferenced task 'usercontrol'

However, since they’re warnings, they shouldn’t have an effect on the program. But when we try to test and start debugging, the robot doesn’t work.

Here’s the code:


/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VEX EDR                      */
/*                                                                           */
/*---------------------------------------------------------------------------*/
#include "Vex_Competition_Includes.c"
#pragma config(Motor,  port1,           one,           tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           two,           tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           three,         tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           four,          tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           five,          tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           six,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port7,           claw,          tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           nine,          tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port10,          ten,           tmotorVex393_HBridge, openLoop)
/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks
  // running between Autonomous and Driver controlled modes. You will need to
  // manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;

	// Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
	// used by the competition include file, for example, you might want
	// to display your team name on the LCD in this function.
	// bDisplayCompetitionStatusOnLcd = false;

  // 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()
{
	motor[port1] = 127;
	motor[port2] = 20;		// turns to exact angle facing goal
	motor[port7] = 67;		// keeps hold on preload
	wait1Msec(1000);		//goes for 1 second
	motor[port1] = 0;			//stop m1 temporarily
	motor[port2] = 0;			//stops m2 temporarily
	motor[port7] = 67;	// keeps hold on preload
	motor[port1] = 127;		// moves toward goal
	motor[port2] = 127;		// moves toward goal
	motor[port9] = 127;	// moves toward goal
	motor[port9] = 127; 	// moves toward goal
//insert positioning here for turning of chassis motors after testing
	wait1Msec(2500);	//goes 2.5 secs.
	motor[port1] = 0;		//stops moving
	motor[port2]= 0;		//stops moving
	motor[port9] = 0;	// stops moving
	motor[port10] = 0; 	// stops moving
	motor[port7] = 67;	// keeps hold on preload
	motor[port3] = 67;	//goes up
	motor[port4] = 67;		//goes up
	motor[port5] = 67;		//goes up
	motor[port6] = 67;		//goes up
	wait1Msec(2500);
	motor[port7] = -100; 	//release claw
	motor[port7] = 0;			//stop claw
  //AutonomousCodePlaceholderForTesting();
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              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()
{
  // User control code here, inside the loop

  while (true)
  {
 		motor[port1] = vexRT(Ch3);
		motor[port2] = vexRT(Ch3);
		motor[port9]= vexRT(Ch2);
		motor[port10] = vexRT(Ch2);
		motor[port3] = vexRT(Btn6U)*127 - vexRT(Btn6D) *127;
		motor[port4] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
		motor[port5] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
		motor[port6] = vexRT(Btn6U) *127 - vexRT(Btn6D) *127;
		motor[port7] = vexRT(Btn5U) *127 - vexRT(Btn5D) *127;
  }
}


#pragma config(Sensor, dgtl1,  QuadLeft,       sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  QuadRight,      sensorQuadEncoder)
#pragma config(Motor,  port1,           FDL,           tmotorVex393_HBridge, openLoop, driveLeft, encoderPort, dgtl1)
#pragma config(Motor,  port2,           FDL2,          tmotorVex393_MC29, openLoop, reversed, driveLeft)
#pragma config(Motor,  port3,           LLT,           tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           LLB,           tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           LRB,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port6,           LRT,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port7,           Claw,          tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           FDR2,          tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port10,          FDR,           tmotorVex393_HBridge, openLoop, driveRight, encoderPort, dgtl3)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VEX EDR                      */
/*                                                                           */
/*---------------------------------------------------------------------------*/

// This code is for the VEX cortex platform
#pragma platform(VEX2)

// Select Download method as "competition"
#pragma competitionControl(Competition)

//Main competition background code...do not modify!
#include "Vex_Competition_Includes.c"

it should look like this. Ignore the motor names and whatever.

Check the competition includes. Make a new competition template file. There should be more files and stuff included besides “competition_includes.c”.

Never modify the “vex_competition_includes.c” file. Ever. Even if you do, be sure to undo the error quickly before something major happens.