Getting Started
We'll show you how to get started coding the robot using VEXCode Pro and C++
First, download VEXCode Pro and install it. Then, open the program and create a new project.
(Note: VEXCode Pro is easier to use than PROS, but is approaching EOL, so more experienced users may choose to use PROS for both the continued updates and additional community software support)
Start Coding
Let's write a simple C++ program to set up the robot:
In this code:
We include the necessary VEX header file,
"vex.h"
, to access VEX V5 API functions and classes.We add
using namespace vex;
to reference vex motors and classes natively.We create the
main
function, which is run when the program is started.We call the
vexcodeInit
function--always do this.We use the
wait
function in a while loop to prevent the code from exiting before the robot can do anything
Building and Downloading Your Code
Connect your V5 Brain to your robot and turn it on.
Connect your computer to the V5 Brain using a USB cable.
Click on the "Download" button (at the top right) to transfer your code to the V5 Brain.
Note that the code above doesn't make the robot do anything quite yet; it is just a foundation to build on. Your first order of business should be coding the drivetrain. See this article:
Expanding Your Knowledge
Now that you've successfully programmed your VEX V5 robot to perform a simple task, you can expand your knowledge by exploring the VEX V5 C++ API and trying out different sensors and motor configurations. The VEX V5 C++ API documentation provides detailed information about classes and functions you can use to control your robot.
Note: C++ is not an easy language to learn and it is often used by the most highly skilled programmers. Expect to fail many times, it is normal.
Last updated
Was this helpful?