🚀 Beginner Onboarding

Your First 30 Minutes

No experience needed. By the end of this guide you will have a PROS project open, a program running on the robot, and your first autonomous line of code working. One task at a time.

1
Welcome
2
Open Project
3
Read Code
4
First Change
5
First Line
6
First Auto
// Section 01
Welcome — What You Will Do Today
This is not a lecture. Every section has one concrete task. You will finish with code running on a real robot.
🌟
The goal for today: get a robot moving with code you understand. Not perfectly tuned, not competition-ready — just working, and understood. That is a bigger deal than it sounds.

What You Need Before Starting

💻
Laptop with VS Code
VS Code installed, PROS extension active. See the Setup Guide if not done.
🧠
V5 Brain + micro-USB
Brain powered on, cable plugged in. See Brain Download guide for connection help.
📱
A robot to drive
Any V5 robot with drive motors works. The Clawbot is ideal — see Clawbot Training.
📁
An EZ Template project
The project folder open in VS Code. If you do not have one yet, the Setup Guide walks through creating it.

How This Guide Works

Each section has one task with a time estimate. Read the explanation, then do the task on your actual laptop with your actual robot. Do not skip the task and just read — the doing is what makes it stick.

If something goes wrong, that is fine and expected. Read the error message, look for the callout boxes marked with a warning icon, and ask your coach if you are stuck for more than a few minutes. Getting unstuck quickly is a skill the whole team builds together.

💡
You do not need to memorize anything. Professional developers look things up constantly. The goal is to understand what each piece does and where to find it — not to have it all in your head. Your job after today is to know what questions to ask.

What You Will Have Accomplished by the End

A PROS project open and navigated
You know where main.cpp is, what it contains, and how the file structure is organized.
Code compiled and uploaded to the Brain
You ran pros build-upload and saw the robot respond to the change you made.
Your first autonomous line written
The robot drives forward on its own when autonomous is enabled. You wrote that line.
// Section 02
Open Your Project
Finding your way around VS Code and the PROS file structure before writing a single character.
🕐 ~5 minutes

Opening the Project in VS Code

1

Open VS Code

Launch VS Code from the Start Menu or your taskbar. If it opens to a blank screen, that is fine — you just need to open your project folder.

2

Open your project folder

Go to File → Open Folder (or press Ctrl+K then Ctrl+O). Navigate to your EZ Template project folder and click Select Folder. VS Code will reload and show the project files in the left sidebar.

3

Confirm PROS is active

Look at the left sidebar for the PROS icon (a blue circle with a P). If it is there, PROS loaded successfully. If not, open the Extensions panel and make sure PROS is installed and enabled.

Understanding the File Structure

Your EZ Template project contains a lot of files. Most of them are the PROS kernel and EZ Template library — you will never touch them. The files you will edit are highlighted below.

MyRobotProject/ ├── src/ │ ├── main.cpp <-- YOUR FILE: hook functions + opcontrol │ └── autons.cpp <-- YOUR FILE: autonomous routines ├── include/ │ └── globals.hpp <-- YOUR FILE: motor and sensor declarations ├── firmware/ <-- PROS kernel — do not touch ├── EZ-Template/ <-- EZ Template library — do not touch └── project.pros <-- project settings (slot, name)
ℹ️
Rule of thumb: if a file is inside EZ-Template/ or firmware/, leave it alone. Everything you need to write is in src/ and include/. VS Code's file explorer makes this easy to see.

Open main.cpp Now

In the VS Code sidebar, click src to expand it, then click main.cpp to open it. It will appear in the main editor area. Leave it open — the next section walks through exactly what each part does.

💡
Keyboard shortcut worth learning today: Ctrl+P opens a quick file finder. Type main and press Enter to jump to main.cpp from anywhere. This saves a lot of clicking as your project grows.
Which file contains your autonomous routines in an EZ Template project?
⬛ main.cpp
⬛ autons.cpp
⬛ globals.hpp
⬛ project.pros
// Section 03
Read the Code — Before You Touch It
The single most important habit in programming: read before you write. This section explains every part of main.cpp so nothing looks mysterious.
🕐 ~8 minutes
💡
Task for this section: read main.cpp with the explanation below. Do not change anything yet — just match what you see in VS Code to the explanations here. Put a mental tick next to each part once you understand what it does.

The Top of the File — Includes and Declarations

src/main.cpp — top
// These lines pull in the PROS and EZ Template tools #include "EZ-Template/drive/drive.hpp" #include "globals.hpp" // This line creates your chassis object — the thing that controls driving ez::Drive chassis( {1, -2, 3}, // left motor ports (negative = reversed) {-4, 5, -6}, // right motor ports 7, // IMU port 3.25, // wheel diameter in inches 360 // motor cartridge RPM (200 = green, 600 = blue, 100 = red) );

The port numbers and wheel diameter are the first things you will customize for your specific robot. For now, just notice the pattern: left ports, right ports, IMU port, wheel size, motor speed.

The initialize() Function

src/main.cpp — initialize()
void initialize() { // Runs ONCE when the Brain powers on ez::as::auton_selector.autons_add({ {"Drive Test", DriveTest}, }); chassis.initialize(); // ↑ This calibrates the IMU and sets up EZ Template }

Think of initialize() as the robot's boot sequence — it runs before any match period. The chassis must be initialized here or nothing else works. The auton selector registration is also here so routes are available before a match starts.

The opcontrol() Function — The Driver Control Loop

src/main.cpp — opcontrol()
void opcontrol() { // Runs during driver control — this loop repeats ~50x per second while (true) { chassis.opcontrol_tank(); // reads joysticks, drives motors // Your mechanism controls go below this line // Example: if (master.get_digital(DIGITAL_R1)) { intake.move(127); } pros::delay(ez::msec2); // wait 20ms — gives other tasks CPU time } }
⚠️
Never remove the pros::delay() from opcontrol. Without it, the loop runs thousands of times per second, starves other PROS tasks of CPU time, and can cause unpredictable behavior. The 20ms delay is standard — leave it in every loop you write.

The autonomous() Function

src/main.cpp — autonomous()
void autonomous() { // Runs for 15 seconds at the start of a match ez::as::auton_selector.call_selected_auton(); // ↑ Runs whichever routine was selected on the Brain screen }

Your autonomous routines live in autons.cpp, not here. This function just tells EZ Template to run whichever one was selected. You registered your routines in initialize() — when autonomous starts, this one line runs them.

Why is pros::delay(ez::msec2) required inside the opcontrol while loop?
⬛ It makes the robot faster
⬛ It is optional — just a good habit
⬛ Without it the loop starves other tasks and causes unpredictable behavior
⬛ It saves battery power
// Section 04
Make Your First Change
Change one value, build the project, upload it, and watch the robot respond differently. This is the core loop of all programming: change → build → test.
🕐 ~7 minutes
🎯
The task: find the chassis speed limit in your code, change it, upload, and confirm the robot drives at a different speed in driver control. One change, one test.

Step 1 — Find the Speed Limit Setting

In main.cpp, inside initialize(), look for a line that sets the drive speed. It will look something like this:

// Inside initialize() — look for something like this: chassis.set_max_speed(127); // 127 = full speed

If your project does not have this line yet, add it inside initialize() right after chassis.initialize(). The number 127 is PROS's maximum motor voltage — it maps to 100% speed.

Step 2 — Change the Value

Change 127 to 60. This limits driver control to about 47% speed — slow enough to clearly notice the difference, fast enough to still drive properly.

// Change this: chassis.set_max_speed(127); // To this: chassis.set_max_speed(60);

Step 3 — Build and Upload

Open the VS Code terminal with Ctrl+` (backtick, top-left of keyboard). Type the following and press Enter:

pros build-upload

Watch the terminal output. You will see lines like Compiling main.cpp then Uploading.... When it finishes with done, the new program is on the Brain.

⚠️
If you see red error lines in the terminal output, the upload did not succeed. Read the first error line — it always tells you the file name and line number where the problem is. Fix that line, then run pros build-upload again. Do not try to fix multiple errors at once.

Step 4 — Test It

Run the program on the Brain (either from the Brain screen or by pressing run). Try driving with the controller. The robot should feel noticeably slower than before.

Once confirmed, change the value back to 127 for full speed and upload again. You have just completed your first change-build-test cycle — this is what programming feels like.

Try it yourself
What happens at 200?
Try setting the speed to 200 instead of 127. What do you expect to happen? Upload and test. What actually happens? Why? (Hint: the V5 motor voltage is capped by hardware — the Brain will not let you exceed the safe maximum.)
You change a value in main.cpp and save the file. The robot still behaves the same way. What did you forget?
⬛ Restart VS Code
⬛ Run pros build-upload to compile and send the new code to the Brain
⬛ Power cycle the Brain
⬛ Nothing — saving automatically uploads
// Section 05
Write Your First Line of Code
Adding something new — not changing an existing value, but writing a line that did not exist before. You will add a rumble to the controller.
🕐 ~5 minutes
🎯
The task: make the V5 controller rumble for half a second when driver control starts. One new line of code, in the right place, uploaded and confirmed working.

Where to Put It

The controller rumble should happen once when opcontrol starts — not inside the while(true) loop. If you put it inside the loop, it will try to rumble 50 times per second, which will not work correctly.

Add the new line before the while(true), like this:

src/main.cpp — opcontrol()
void opcontrol() { // ADD THIS LINE HERE — before the loop master.rumble("."); // one short buzz = driver control started while (true) { chassis.opcontrol_tank(); pros::delay(ez::msec2); } }
ℹ️
The rumble pattern string uses dots and dashes like Morse code. "." = short buzz, "-" = long buzz, " " = pause. Try ".-." for a long buzz between two short ones. The controller hardware limits the length.

Understanding What You Just Wrote

Let us break down master.rumble("."); into its parts:

master
the V5 controller object, declared in globals.hpp
.rumble
a function that belongs to the controller
(".")
the argument — the pattern string passed to the function
;
semicolon — ends every statement in C++

This pattern — object.function(argument); — is the most common structure in all of your robot code. chassis.drive_distance(24) is the same pattern. arm.move(127) is the same pattern. Once you recognize it, reading new code becomes much easier.

Build, Upload, and Test

Run pros build-upload in the terminal. When driver control starts (either from the Brain screen or competition switch), you should feel the controller buzz once. If it does not buzz, check that your controller is paired to the Brain.

Go further
Add a second rumble at the end
PROS lets you schedule a task to run after a delay. But there is an easier way to test this concept: add a pros::delay(90000) (90 seconds) after your loop starts, then another master.rumble("-") after the delay. This simulates a "match end" warning buzz. Where in the code would this go? How would it behave differently if you put it inside vs outside the while loop?
// Section 06
Write Your First Autonomous Routine
The robot moves on its own — no driver, no joystick, just the code you wrote. This is the foundation of everything that comes next.
🕐 ~10 minutes
🏆
The task: write a function in autons.cpp that drives the robot forward 24 inches, stops, and holds. Register it in the auton selector. Run it using the Brain screen.

Step 1 — Open autons.cpp

In the VS Code sidebar, expand src/ and open autons.cpp. You will see the existing autonomous functions — they may be empty placeholders or have some example code depending on which EZ Template version you downloaded.

Step 2 — Write the Function

Add this function at the bottom of autons.cpp, after all the existing code:

src/autons.cpp — add at the bottom
// Your first autonomous routine void DriveTest() { chassis.drive_distance(24); // drive forward 24 inches // That's it for now! }

drive_distance(24) is a blocking function — it will not return until the robot has traveled 24 inches (or timed out trying). EZ Template's PID controller handles the motor corrections automatically. You just tell it where to go.

Step 3 — Declare the Function in globals.hpp

Open include/globals.hpp. Find the section where other autonomous functions are declared — it will look something like this:

// In globals.hpp — function declarations void DriveTest(); // ADD THIS LINE

This declaration tells the compiler that DriveTest() exists — even though it is defined in a different file. Without this line, main.cpp will not be able to call it and you will get a compile error.

Step 4 — Register It in the Auton Selector

Open main.cpp. Inside initialize(), add your routine to the autons_add list:

src/main.cpp — inside initialize()
ez::as::auton_selector.autons_add({ {"Drive Test — 24 inches", DriveTest}, // ADD THIS });

The first part is the display name on the Brain screen. The second part is the function name — no parentheses, just the name itself.

Step 5 — Build, Upload, and Run

1

Build and upload

Run pros build-upload in the terminal. Fix any errors that appear before moving on.

2

Select your routine on the Brain

On the Brain screen, navigate to your program and run it. The auton selector should show "Drive Test — 24 inches". If it does not appear, check that autons_add is inside initialize() and re-upload.

3

Enable autonomous from the Brain

From the Brain's program screen, select the program and run autonomous mode. The robot should drive forward 24 inches and stop. If you have a competition switch, use it to test the full disabled → autonomous sequence.

💡
If the robot drives the wrong direction — forward when it should go backward, or vice versa — one or more motor ports need to be negated. Open main.cpp, find your chassis port list, and add a minus sign (-) before the port numbers for motors that are spinning backward. This is normal on the first setup of any robot.

Congratulations — You Just Wrote an Autonomous Routine

🏆
30 minutes complete
You opened a PROS project, read and understood main.cpp, changed a value and saw the result, wrote a new line of code, and created a working autonomous routine. That is the entire programming loop — you just did it.

What to Do Next

Next step
Naming Conventions
Learn how to name variables and avoid reserved words — essential before writing more code.
Next step
Clawbot Training
5 progressive exercises — arm control, claw toggle, full autonomous mission.
Next step
PID Diagnostics
Your drive_distance is working — now learn to tune it so it stops accurately.
In an EZ Template project, where do you write your autonomous routine functions?
⬛ Inside the autonomous() function in main.cpp
⬛ In autons.cpp, then register them in initialize() in main.cpp
⬛ In globals.hpp
⬛ Anywhere — it does not matter
⚙ STEM Highlight Computer Science: Syntax, Semantics & Compilation
Learning C++ is learning two things simultaneously: syntax (the grammar rules the compiler enforces) and semantics (what the code actually does when it runs). A syntax error stops compilation; a semantic error compiles but produces wrong behavior. Types in C++ (int, double, bool) are a formal system that prevents certain semantic errors at compile time — the compiler rejects pros::Motor arm = 12000; because the types do not match. This is called static type checking.
🎤 Interview line: “C++ uses static type checking — the compiler verifies that operations are applied to compatible types before the program ever runs. This prevents entire classes of bugs that would only appear at runtime in dynamically-typed languages like Python. Understanding type systems is fundamental to understanding why compiled languages like C++ are used in systems that must be reliable.”
🔬 Check for Understanding
Your code compiles with no errors but the robot drives in the wrong direction. This is most likely:
A syntax error the compiler missed
A semantic error — the code is grammatically correct but logically wrong (probably a reversed motor sign)
A hardware failure — code errors always produce compile errors
The compiler is broken
Related Guides
🪾 Clawbot Training → 🧩 Blocks → Text Code → 📡 Brain Download →
← ALL GUIDES