Five methods in order from easiest to most powerful. Open this when something is broken and you don't know why.
Print any value to the Brain's 240ร272px LCD while the robot runs. Perfect for checking sensor reads, variable values, and task state between matches.
// Clear screen + print multiple values pros::lcd::initialize(); // in initialize() // Anywhere in your code: pros::lcd::set_text(1, "IMU: " + std::to_string(chassis.imu.get_heading())); pros::lcd::set_text(2, "Motor temp: " + std::to_string(left_motors[0].get_temperature())); pros::lcd::set_text(3, "Intake on: " + std::to_string(intakeOn));
PROS routes printf() over USB to your VS Code terminal. Run pros terminal in the integrated terminal while the robot is connected.
// Print formatted output to terminal printf("[auton] segment 2 start โ heading: %.2f\n", chassis.imu.get_heading()); printf("[intake] speed=%d temp=%.1f\n", intake.get_actual_velocity(), intake.get_temperature()); // Structured log: timestamp + label + value printf("[%dms] motor_temp %.1f\n", pros::millis(), left_motors[0].get_temperature());
\n at the end of every printf โ it flushes the buffer.[subsystem] so you can grep the output.#define DEBUG flag before competing.// Debug wrapper โ removes all prints in release build #define DEBUG 1 #ifdef DEBUG #define LOG(fmt, ...) printf(fmt, ##__VA_ARGS__) #else #define LOG(fmt, ...) #endif // Use LOG() instead of printf() everywhere LOG("[auton] turn complete โ actual: %.2f\n", chassis.imu.get_heading());
When you can't read the Brain screen (robot is far away, or screen is obstructed), use the V5 Brain's built-in status LED or an indicator LED on a 3-wire port to show state.
// Flash an LED N times to indicate state pros::ADIDigitalOut led('A'); void ledFlash(int n) { for (int i = 0; i < n; i++) { led.set_value(1); pros::delay(150); led.set_value(0); pros::delay(150); } pros::delay(400); // gap between sequences } // Flash 1 = step 1 reached, flash 2 = step 2, etc. ledFlash(1); chassis.pid_drive_set(24, 110); chassis.pid_wait(); ledFlash(2); chassis.pid_turn_set(90, 90); chassis.pid_wait();
Write data to a CSV on the Brain's microSD card. Insert a microSD into the Brain, then read the file on your laptop after the run.
#include <fstream> void startLog() { std::ofstream log("/usd/run_log.csv", std::ios::app); log << "time,heading,left_vel,right_vel,temp\n"; log.close(); } void logRow() { std::ofstream log("/usd/run_log.csv", std::ios::app); log << pros::millis() << "," << chassis.imu.get_heading() << "," << chassis.left_motors[0].get_actual_velocity() << "," << chassis.right_motors[0].get_actual_velocity() << "," << chassis.left_motors[0].get_temperature() << "\n"; log.close(); } // Call logRow() every 50ms in a task for a full run record
run_log.csv in Excel or Google Sheets โ graph motor velocities to spot stalls.PROS ships a terminal dashboard that shows motor ports, temperatures, currents, and sensor values updated live. Run it while connected via USB.
# In VS Code integrated terminal pros terminal # Separate window for motor dashboard pros monitor
| Situation | Method |
|---|---|
| No laptop, need to see sensor values now | 1 โ Brain screen |
| Auton fails at a specific step โ want to know which | 2 โ Terminal printf with labels |
| Robot is moving and you can't read the screen | 3 โ LED flash patterns |
| Intermittent failure, hard to reproduce, want to analyze after | 4 โ SD card log |
| Motor overheating or brownout โ not sure which port | 5 โ pros monitor |