VEXLearn Foundations
Start with basic C++ in the VEXLearn template. Then configure the motors, change how the controller drives the robot, and write an autonomous routine. The last modules cover PID tuning and testing the same route across repeated runs.
A school club can aim for one module per meeting. Allow extra meetings for Modules 5 through 7 if you are tuning or testing on a robot.
Intended Audience
- Students with little or no previous C++ experience
- New VEX programmers
- Teams transitioning from block coding to text-based programming
- Mentors teaching beginner VEX V5 software
- Students who want to understand robot code before moving to more advanced frameworks
Choose a course path
Code learning path
Use a computer to read, modify, and explain the template. Complete Modules 0 through 4, the code-reading versions of Modules 5 through 7, and a written capstone design.
Robot programming path
Build and test the capstone on a tank-drive VEX V5 robot. You need separate left and right motor groups, a V5 inertial sensor, the official VEX extension for VS Code, and a safe testing area.
Course Progress
Mark each module complete as you work. Progress is stored only in this browser on this device.
- Module 0 complete
- Module 1 complete
- Module 2 complete
- Module 3 complete
- Module 4 complete
- Module 5 complete
- Module 6 complete
- Capstone complete
Module 0: Orientation and Baseline
Choose a pathway, install your tools, and locate the files you will use throughout the course.
Follow-along setup lab
Check each step when it matches what you see on your computer. Progress is saved in this browser.
-
1. Install VS Code
Get the VS Code installer for your operating system. Install it and open VS Code.
-
2. Add the VEX extension
Open Extensions in VS Code. Search for VEX Robotics and install the extension published by VEX Robotics.
-
3. Open the project
Download and extract the Template ZIP. In VS Code, choose File → Open Folder and select the inner
VEXLearn Templatefolder containingmakefile.VEXLearn Template/ include/ src/ vex/ makefile -
4. Find the starting file
Open
src/main.cppin the Explorer. Look formain()and the call topre_auton(), which prepares the robot before the match.src/ main.cpp robotConfig.cpp drive.cpp movement.cpp auto.cpp display.cpp
Working with a robot? Open the robot setup checklist and return here for the baseline activity.
Required Reading
Activities
- Complete the pre-course assessment.
- Write one sentence describing the purpose of each of the six source files shown in the setup lab.
Evidence and Checkpoint
Submit a completed setup checklist, baseline score, six-file project map, and selected pathway. Pass by correctly matching at least five of the six major source files with their purpose.
Download pre-course assessmentModule 1: C++ Fundamentals for VEX
Identify common data types, declare and update variables, use operators, read control structures, explain function signatures, and distinguish declarations from definitions.
Required Reading
Data Types, Variables, Operators, Loops and If-Statements, Functions, Header Files, File Integration, and Namespaces.
Activity 1: Predict the Result
Predict the final value before running or checking this code:
int speed = 5;
speed += 2;
if (speed > 6) {
speed = 6;
}Check your prediction
speed ends at 6. Adding 2 makes it 7, so the condition is true and the assignment sets it to 6.
Activity 2: Repair the Code
Correct at least five errors involving missing semicolons, incorrect variable types, assignment versus comparison, misspelled function names, and missing header declarations.
Activity 3: Write a Function
double limitVoltage(double requestedVoltage, double maximumVoltage);The function must return a value that does not exceed the positive or negative maximum.
Evidence and Checkpoint
Submit the corrected exercise, completed function, a short explanation of declaration versus definition, and the module quiz. Score at least 75% on the quiz.
Download debugging exerciseModule 2: Understanding the VEXLearn Project
Trace functions across source and header files, explain the role of main.cpp, connect VEX objects to physical hardware, and identify Smart Ports and three-wire ports.
Required Reading
Program Structure, Header Files, Object-Oriented Programming and VEX Objects, How Ports Work, Connecting to the Brain, and Downloading Software.
Activity 1: Trace a Function
Trace move() from movement.h to movement.cpp and then to a call in auto.cpp. Identify where it is declared, defined, and called, and explain each argument.
Activity 2: Hardware Map
| Hardware | Software object | Port | Reversed? | Purpose |
|---|---|---|---|---|
| Left front motor | LeftMotor1 | 1 | Yes | Chassis |
| Inertial sensor | Inertial | 9 | N/A | Heading |
Students without a robot use the default template configuration.
Activity 3: Explain an Object
Explain why Inertial.heading(); uses both an object and a function.
Evidence and Checkpoint
Submit the function-tracing worksheet, hardware/software map, and annotated project diagram. Correctly explain the relationship among robotConfig.cpp, robotConfig.h, and the other source files.
Module 3: Robot Configuration and Driver Control
Configure motors and sensors, modify motor groups and driver behavior, change controller mappings, and use a Boolean variable to toggle a mechanism.
Required Reading
Robot Setup Checklist, How Ports Work, Gear Ratio and Software, 6-Watt versus 12-Watt Motors, robotConfig.cpp, and drive.cpp.
Activity 1: Configure the Robot
Hardware-path students update motor ports, directions, groups, sensor and piston ports, wheel diameter, and external gear ratio. Code-learning students create a hypothetical six-motor tank-drive configuration.
Activity 2: Change Driver Preferences
Modify at least two of the following: deadband, controller sensitivity, coast-to-brake timing, button mapping, or mechanism speed.
Activity 3: Add a Mechanism Toggle
Implement or modify a Boolean-based controller toggle for a piston or another mechanism.
Evidence and Checkpoint
Submit a configuration commit or saved code copy, explain two modifications, and record the compilation result and hardware demonstration when available. The program must compile, or the student must correctly identify and explain the remaining compilation problem.
Download configuration plannerModule 4: Autonomous Movement
Explain auto.cpp, use move() and turn(), understand their arguments, plan routes, and recognize when an advanced odometry-based template is more appropriate.
Required Reading
Absolute Heading, Voltage versus RPM Control, Writing Autonomous Functions, movement.cpp, and auto.cpp.
Activity 1: Read Movement Calls
move(100, 0, 8);
turn(90, 6);
move(50, 90, 6);Explain the expected behavior of each line, including distance, heading, and voltage.
Check your route reading
The first call moves 100 cm while holding 0° with an 8 V limit. The turn targets 90° with a 6 V limit. The last call moves 50 cm while holding 90° with a 6 V limit.
Activity 2: Plan a Route
Draw a route with a starting position, distances, headings, mechanism actions, and expected ending position.
Activity 3: Write a Three-Step Routine
Include at least one move(), at least one turn(), and at least one additional movement or mechanism action.
Evidence and Checkpoint
Submit the route diagram, autonomous source code, and an explanation of every movement argument, followed by a code review or physical demonstration. Explain what the robot should do without running the program.
Download route plannerModule 5: PID Tuning Laboratory
Explain proportional, integral, and derivative control; identify windup, overshoot, oscillation, and steady-state error; and select tuning values using controlled evidence.
Required Reading
PID Controller, Integral Windup, Interactive PID Demo, Voltage versus RPM Control, and the PID sections in movement.cpp.
Laboratory Rules
- Use the same starting position, target distance, and maximum voltage.
- Change only one PID value at a time.
- Record battery percentage for every trial.
- Use a physical starting aligner and record trials on video when possible.
Activities
- Adjust
Kpand record response speed, overshoot, final error, and oscillation. - Adjust
Kdand observe changes in oscillation and overshoot. - Explain integral accumulation, voltage saturation, and why accumulated error resets after crossing the target.
- Justify final constants using at least three recorded trials.
Required Trial Data
| Trial | Kp | Ki | Kd | Target | Final error | Overshoot | Oscillation | Battery | Notes |
|---|---|---|---|---|---|---|---|---|---|
| 1 | |||||||||
| 2 |
Evidence and Checkpoint
Submit at least eight documented trials, final constants, a before-and-after comparison, and a paragraph explaining the decision. Each team defines its tolerance before testing. A suggested standard is at least eight of ten trials within that distance or heading tolerance.
Download PID laboratory logModule 6: Reliability, Debugging, and Testing
Separate software from hardware failures, use repeated trials, record failure conditions, evaluate environmental factors, and revise code using testing evidence.
Required Reading
Writing Autonomous Functions and the stopping and timeout behavior in movement.cpp.
Activities
- Classify failures as configuration, compilation, control logic, sensor, mechanical, starting-position, battery or power, or unknown.
- Run the same autonomous routine ten times and record success, ending error, battery, failure category, and notes.
- Identify the most frequent failure, make one change, and complete five more trials.
Evidence and Checkpoint
Submit the ten-run baseline, one documented revision, five-run retest, before-and-after success rate, and a short failure analysis. Explain why one successful run does not prove an autonomous routine is reliable.
Download reliability logModule 7: Final Autonomous Capstone
Design, program, test, and explain a short autonomous routine using the VEXLearn template.
Minimum Requirements
- At least three movement commands and one turn
- At least one mechanism action when hardware permits
- A planned starting position and route diagram
- A safe timeout or bounded movement behavior
- At least ten documented physical trials for the Robot Programming Path
The Code Learning Path submits the complete route, code, predicted behavior, and testing plan without physical trial results.
Required Submission
- Route diagram
- Source code
- Hardware configuration
- PID values
- Trial log
- Short demonstration video
- Failure analysis
- Final reflection
Reflection Questions
- What part of the routine was least reliable?
- Which change produced the largest improvement?
- What evidence supports your final PID values?
- What hardware behavior affected the software?
- What would you change with another week?
- When would a more advanced framework such as JAR Template or LemLib become appropriate?
Capstone Rubric
| Category | Points |
|---|---|
| Correct project and hardware configuration | 15 |
| Understanding of C++ and project structure | 15 |
| Driver-control or mechanism modification | 10 |
| Autonomous planning and implementation | 20 |
| PID tuning process | 15 |
| Reliability testing and evidence | 15 |
| Explanation, documentation, and reflection | 10 |
| Total | 100 |
Performance Levels
- 90-100: Independent. The student can configure, program, test, explain, and improve the system with little assistance.
- 75-89: Proficient. The student completes major tasks but needs occasional guidance while debugging or tuning.
- 60-74: Developing. The student understands basic concepts but needs substantial support with configuration, debugging, or autonomous testing.
- Below 60: Incomplete. The student should revisit modules connected to missing or incorrect capstone elements.
Pre-Course and Post-Course Assessment
Use the same concepts before and after the curriculum, but change numerical values and code examples so the post-test does not reward memorizing answers.
- What is the difference between
int,double, andbool? - What does
==mean, and how is it different from=? - What does a
whileloop do? - What is the purpose of a header file?
- Where are VEX motors and sensors configured?
- What does the
headingargument inmove()control? - Why must the software gear ratio match the physical drivetrain?
- What does the proportional term of PID respond to?
- What is integral windup?
- Why should an autonomous routine be tested multiple times?
- Name two non-software factors that can change autonomous performance.
- When should a team consider moving from VEXLearn to an odometry-based template?
Questions 1-6 are worth one point each. Questions 7-12 are worth two points each, for 18 points total. Record initial and final scores, percentage-point improvement, module completion, capstone score, autonomous trial success rate, and student confidence before and after.
Download post-course assessment
Instructor Guidance
VEXLearn is designed to help students understand beginner VEX V5 software. Instructors should ask students to explain code before copying or modifying it. Physical movement activities must be conducted in a clear testing area with the robot raised or restrained during initial mechanism tests.
The curriculum prioritizes understanding, testing, and documentation over achieving one universal performance threshold. Different robots require different PID values and tolerances.
What to record during the pilot
Record how many students start and finish, how assessment scores change, and how many complete the capstone. Note where students get stuck and what you change in response.