Using the Competition Template in VEXcode Pro V5

The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.

VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.

Opening the Competition Template in VEXcode Pro V5

V5 Category Description tutorial image illustrating key features and components of the V5 system, including labeled parts and their functions, designed to assist users in understanding the system's functionality.

Click on “File” on the top left of the VEXcode Pro V5 app, then select “Open Examples…” from the dropdown menu.


Selecting the Competition Template

Screenshot of a tutorial interface for V5 Category Description, showcasing various features and options available for users in the Vex Robotics platform.

From the “Examples” window, you will see two different competition “Templates.”

  1.  “Clawbot Competition Template”. This template comes with V5 Clawbot devices pre-configured.
  2.  “Competition Template”. This template doesn’t come with any device configurations.

We will be using the “Competition Template” for our example since the steps are the same for either template.

NOTE: The Competition Template is a sample project that sets up all of the necessary callbacks in order to communicate with the Field Control System during competitions, ensures code is in compliance with field regulations, and aids in setting up programs in order to avoid complications and disqualification ("competition" refers to a VRC event using the official field control hardware).  


Naming Your Project

Screenshot of a V5 category tutorial interface, showcasing various options and features for users to navigate and utilize in their robotics projects.

Enter a project name of your choice. Then click “Create.”


NOTE: Project names must NOT contain any spaces and must be less than 20 characters long.


Understanding the Three Sections of the Competition Template.

Diagram illustrating the V5 category features and functionalities, showcasing various elements related to tutorials in the VEX Robotics platform.

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:

  1. Leave the code below inside the main function in place.
  2. Add your code inside one of the three functions (pre_auton, autonomous, usercontrol).

Using a Pre-auton Function for Any Setup Steps

Screenshot of a tutorial interface for V5 robotics, showcasing various programming options and tools available for users to enhance their robotics projects.

Add any setup steps such as gyro calibration, or other sensor resets that should run when the program is started, to the pre_auton function.

NOTE: The code inside the pre_auton function below will run immediately when the program is started, before the autonomous portion of the match begins.

NOTE: If you choose not to use this section, leave it empty.


Using the Autonomous Function for Any Autonomous Routine

Screenshot of a tutorial interface for V5 robotics, showcasing various programming options and tools available for users to enhance their learning experience.

Put the code for your autonomous routine into the autonomous function. Your autonomous function must only contain commands that won’t need any interaction from a user. (E.g., BumperA.pressing())You should avoid any commands that require a user’s interaction. E.g Controller1.ButtonA.pressing();

NOTE: You can copy and paste this code from another project file.


Using the usercontrol Function for Any User Controlled Routines that Take Place During the Driver Controlled Period

Screenshot of a V5 category tutorial interface, displaying various options and features for users to explore, aimed at enhancing understanding of V5 functionalities.

The usercontrol function must only contain commands controlled by the user. (E.g. Controller1.Axis1.position();)Put your driver control code into the usercontrol function, inside the while(1) loop and before the wait(20, msec) command.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: