How to Create a Program Using the Competition Template (VCS VEX C++)

Get more with VEXcode
We recommend you transition to our new software. VEXcode has both block-based and text-based options, that work on Chromebooks, iPads, Android tablets, Windows and Macs. Visit code.vex.com for more details on how to download VEXcode.
VEX Coding studio has been discontinued and is no longer available for download. Already downloaded? The program will continue to function but will no longer be supported.
Users who transition to VEXcode can migrate their C++/C++ Pro projects to VEXcode Text by following this article.

Step 1: Open the competition template in VEX Coding Studio

  • Follow the steps shown in the animation to get to the competition templates folder.
  • In the folder browser that pops up, choose the VEX C++ folder, then choose Competition Template.vex

NOTE: The Competition Template is a sample program 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).  

Step 2: Understand the three sections of the template

  • The competition template has three sections that correspond to the three phases of a competition match: robot setup, autonomous, and driver control.
  • In order for your code to work at a competition, you must leave this code in place and add your code inside the sections.

Step 3: Use a pre-autonomous routine for any setup steps

  • 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:  This code will run immediately when the program is started, before the autonomous portion of the match begins.

NOTE: You may not have any setup steps. If so, leave this section empty.

Step 4: Add your autonomous routine

  • Put the code for your autonomous routine into the autonomous function.

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

Step 5: Add your driver control code

  • Put your driver control code into the usercontrol function, inside the while(1) loop and before the vex::task::sleep command.