Autonomous Code-RobotC

Here’s the code I’;m using for autonomous on RobotC, but the robot does nothing. What am I doing wrong?

#pragma config(Motor, port2, motor1, tmotorVex393_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{
motor[motor1] = 127;
wait1Msec(200000);
motor[motor1] = 0;
wait1Msec(200);

}

Use the competition template if you’re using a competition switch (as your title implies).

1 Like

I think I’m using a competition system. how do I change it to the competition tenplate?

When you run the program do you have to competiton switch plugged into the controller and switched to automnoumose mode enable?

If thats all you have in your robot, its not using the competition template. The competition template does not have a main task. Open up the sample programs or from File, New and find the competition template. Follow the instructions in that file.

Youtube video:

Vex tutorials:
http://help.robotc.net/Sandbox/Zendesk-Output/Content/Resources/topics/Getting_Started/Cortex/Competition_Templates.htm

1 Like

You need to put the code inside of a While loop

task main()
{
while (true) {

motor[motor1] = 127;
wait1Msec(200000);
motor[motor1] = 0;
wait1Msec(200);

}
}

Edit:
This is wrong, this will keep making the code loop.
I was thinking of the wrong problem. Sorry for any confusion.

No please don’t spread false information.

2 Likes

Your right, i’m just dumb and got things mixed up in my head.
Sorry.

Thank you so much for all your help! I got the competition template and got everything working, but the robot is not doing anything. I pity the code into the template and am using a different line of code that I tested and it works. What can I do to get the robot to run?