Autonomous Problems

[FONT=“Times New Roman”][/FONT]
I’m trying to program an autonomous for our team on ROBOTC 4.0.
Please help, compitition in two weeks from whenever this was posted.

Error:
Warning:Unreferenced task ‘autonomous’

Autonomous Code:

task autonomous()
{
motor[FR] = 127;
motor[FL] = 127;
motor[BR] = 127;
motor[BL] = 127;
wait1Msec(500);
stopMotor(FR);
stopMotor(FL);
stopMotor(BR);
stopMotor(BL);

motor[ARM] = 127;
motor[ARM] = 127;
wait1Msec(250);
stopMotor(ARM);
stopMotor(ARM2);

motor[FR] = 127;
motor[FL] = -127;
motor[BR] = 127;
motor[BL] = -127;
wait1Msec(1500);
stopMotor(FR);
stopMotor(FL);
stopMotor(BR);
stopMotor(BL);

motor[ARM] = 127;
motor[ARM] = 127;
wait1Msec(250);
stopMotor(ARM);
stopMotor(ARM2);

motor[FR] = -127;
motor[FL] = -127;
motor[BR] = -127;
motor[BL] = -127;
wait1Msec(1500);
stopMotor(FR);
stopMotor(FL);
stopMotor(BR);
stopMotor(BL);

motor[FR] = -127;
motor[FL] = 127;
motor[BR] = -127;
motor[BL] = 127;
wait1Msec(1500);
stopMotor(FR);
stopMotor(FL);
stopMotor(BR);
stopMotor(BL);

}

Is this the entire code? You have to use the competition template. It appears you are not using the competition template, therefore it is not “activating” autonomous at any point. You simply have a task created.

That is only the autonomous part of the code. Also, I tried putting it on the competition template and tested it on a dummy robot, I’m not sure if the code is faulty or if it’s the robot.

If you are running this by itself, it looks like you are making your code a task (autonomous), but RobotC is getting mad because you aren’t using the task anywhere. The program should still work and compile, as long as you have something set up to run the task.

If you are using the competition template, are you using the VexNet competition switch to chose between autonomous and driver control?

make sure you have


#include Vex_Competition_Includes.c

at the top of the file

that should be referencing the autonomous task

We can’t really help more without your .c file. If your posted your actual file as an attachment we could tell you what is wrong very quickly.

Or just copy and paste the ENTIRE code on here. If all you have is what is shown above, it will not work. But we are stuck guessing what is wrong because we don’t know the rest of your code.

Okay, here is my code. I tried using a competition Template, pressed compile, gave me the same warning.
7478R Autonomous 3.c (2.61 KB)

You aren’t using the competition template. Go to new > file > Competition template (I think). This will give you pre_auton(), autonomous(), and usercontrol() blocks. Copy over the code that is in your main() function into the usercontrol(), and copy the autonomous() over.

The problem has been fixed, turns out I deleted the:

#pragma competitionControl(Competition)
#pragma autonomousDuration(15)
#pragma userControlDuration(150)

#include “Vex_Competition_Includes.c”

part, I didn’t even know it said not to delete that part. (via //):stuck_out_tongue: