Ascend
Coding
Ascend
  • 🚀Introduction
  • VEX Robotics
    • 🛠️Building
      • 📏CAD Design
      • 🔧Best Practices
      • 🏎️Drive Trains
        • 🔩Screw Joints
        • 🥊Boxing
        • 🔵Bearing flats
        • 🛤️Fixing Friction
        • 🔥450 RPM on 2.75"
      • 🏍️Motors
      • 🪨Metal
      • Plastic
      • 🎈Pneumatics
      • ➕Additional Mechanisms
        • 🖨️3D Printing
        • ↔️Ratchets
        • 🏹Catapults
        • 🎣Intakes
        • 🏋️Lifts
    • 💻Coding
      • ⚖️Choosing Your Coding Environment
      • 🔴VEXCode Pro
        • 🖥️Getting Started
        • 🚗Drive Code
        • 🚴Coding Motors
        • 🌬️Coding Pneumatics
        • 🎛️Advanced
          • 📡Coding Autonomous
          • 📈Coding PIDs
            • ⬆️Drive PID Tutorial
            • ↩️Turn PID Tutorial
            • 🎸Tuning PIDs
              • 🔢Ziegler-Nichols Method
              • 📊Graphing PIDs
          • 📋Tasks
          • 🚝Advanced Drive Code
      • 🟡PROS
    • 📗Engineering Notebook
      • 📔Formatting
      • ⭐Notebook Walkthrough
      • 💠Decision Matrices
        • 📌Decision Point
      • ➕Additional Resources
    • 🏆Tournaments
      • 🗣️Team Interviews
        • 🪙Interview Tips
        • ⛳Interview Scoring
        • 🤽‍♀️Interview Practice Questions
      • 🤹Skills
      • ℹ️Ranking and Stats
      • 📷Filming Matches
  • Other
    • 🧑‍💼Management
      • 🕑Time Management
      • 👨‍👩‍👧‍👦Team Management
        • 👮Delegation
        • ⚓Optimal Team Size
      • 🖇️Code Management (GitHub)
      • 🚋Resource Management
      • ⁉️Stuck?
    • 🍎Physics
      • ⚙️Torque
      • 😑Stress Forces
    • 👾Extra stuff
      • 📸96504 Gallery
      • ⛑️VEX Team Resources (High Stakes)
      • 🏎️Driving Simulator
Powered by GitBook
On this page
  • Start Coding
  • Building and Downloading Your Code
  • Expanding Your Knowledge

Was this helpful?

  1. VEX Robotics
  2. Coding
  3. VEXCode Pro

Getting Started

PreviousVEXCode ProNextDrive Code

Last updated 10 months ago

Was this helpful?

We'll show you how to get started coding the robot using VEXCode Pro and C++

First, download 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:

#include "vex.h" 

using namespace vex;

int main() {
    vexcodeInit(); //leave this line here! Everything else has to come after it.
    
    //prevent the main loop from exiting
    while(true) {
        wait(20, msec);
    }
}

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

  1. Connect your V5 Brain to your robot and turn it on.

  2. Connect your computer to the V5 Brain using a USB cable.

  3. 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.

💻
🔴
🖥️
VEXCode Pro
🚗Drive Code
VEX V5 C++ API: vex Namespace Reference