A template with the function callbacks for autonomous and usercontrol mode is required to perform in a vex competition. When you are at a competition you connect your robot to the field controller that will start and stop your code based on timer and mode of the match. If you code is not in this template it will not run properly.
A competition Template is available in the VS code IDE.
In VS code check that you have the vex extension installed.
The V on the left sidebar is the vex extension, when you click it you get the next window and click New Project, that will open the next window with platform selection, select V5.
Select C++
Select V5 Competition Template Project, you will be prompted to name the project and write a description. Give it a name that is meaningful, like PushBackJuly25 or stateCode2024, the description is not required but sometimes helpful.
In the window that opens click the arrow next to >src then click main.cpp. this is your main code, almost everything for a vex competition robot can be written in this file.
Here is the code that is in main.cpp you can open a new project and copy paste this code to start or you cold find this code from the example codes that VexCode offers.
NOTE: The competition template has three sections that correspond to the three phases of a competition match: Pre Autonomous (robot setup), Autonomous period, and Driver Controlled Period.
In order for your code to work at a competition, you must:
pre_auton
, autonomous
, usercontrol
).