Skip to content
FRC Article 5 min read

FRC Programming Tutorial: Getting Started with WPILib

A beginner-friendly guide to programming an FRC robot with WPILib: pick a language, install the tools, write your first robot program, and deploy it.

Browse the guides
to read
5 min

to read

words
894

words

sections
6

sections

If you just got handed the laptop and told "you're on programming this year," WPILib is where you start. It is the official software library FIRST provides for writing code that runs on your robot, and once you know the basic loop it is far less scary than it looks.

Pick a language first

WPILib officially supports three text-based languages, and they are kept at near feature-parity so you are not locked out of anything by choosing one:

  • Java (WPILibJ) - the usual recommendation for new programmers. Good balance of convenience and performance, and the largest pile of beginner tutorials and example code.
  • C++ (WPILibC) - more raw performance, but you manage memory yourself, so it asks more of you.
  • Python (RobotPy) - convenient and readable, though as an interpreted language a typo can crash your robot mid-match instead of failing at compile time.

Most rookie programmers should start with Java. The concepts you learn transfer directly to the other two if your team switches later. Our Programming guide goes deeper on choosing for your specific team.

Install the WPILib toolchain

Do not piece this together from scattered downloads. WPILib ships one offline installer, released each season on the WPILib GitHub releases page (the 2026 release is 2026.x). Download the file for your operating system and run it.

The installer sets up everything you need in one shot:

  • A dedicated copy of VS Code labeled for the year (for example "WPILib VS Code 2026"), kept separate from any VS Code you already have so updates do not break it.
  • A Java JDK, the C++ toolchains, and the Gradle build system.
  • Dashboards and utilities like Glass, Elastic, AdvantageScope, SysId, and the roboRIO Team Number Setter. (Shuffleboard and SmartDashboard still ship with the installer but are deprecated and slated for removal in an upcoming season, so build your habits on Elastic for driving and AdvantageScope for debugging instead.)

Install the full offline package rather than the online one when you can - the build server room at competition rarely has reliable Wi-Fi.

Create your first project

Open the WPILib VS Code, then open the command palette with Ctrl+Shift+P and run "WPILib: Create a new project." You will pick a project template, your language, a folder, and your team number. The simplest starting template is built on the TimedRobot base class, which is the structure FIRST recommends for most teams.

A TimedRobot program is just a set of methods that the framework calls for you. The key ones are 'robotPeriodic', 'autonomousPeriodic', and 'teleopPeriodic'. WPILib calls each periodic method every 20 milliseconds - that is 50 times per second - so your job is to describe what should happen in one slice of time, and the framework handles repeating it.

Here is the mental model: 'teleopPeriodic' runs 50 times a second while a driver is in control, so reading a joystick and setting a motor speed inside it makes the robot respond in real time.

Understand command-based programming

Once you can drive, the next step most teams take is command-based programming, a design pattern WPILib supports out of the box. It splits your robot into two ideas:

  • Subsystems - a chunk of hardware that works as a unit, like a drivetrain or an arm with its motors and sensors.
  • Commands - an action, like "drive forward two meters" or "raise the arm," that runs until it finishes or gets interrupted.

The CommandScheduler ties them together and runs at the same 50 Hz. The big win is that a subsystem can only be claimed by one command at a time, which stops two pieces of code from fighting over the same motor - a very common rookie bug. It also keeps your codebase reusable from season to season.

Build and deploy to the roboRIO

Your code does not run until it is compiled (built) and pushed onto the roboRIO, the robot's brain. To deploy from VS Code, hit Shift+F5 or run "WPILib: Deploy Robot Code" from the command palette.

A few things that trip up new teams:

  • Connect first. Your laptop must reach the robot over USB, Ethernet, or the robot's own wireless network before deploying.
  • Match your team number. The number in 'wpilib_preferences.json' must match the number your roboRIO was imaged with, or the deploy will not find the robot.
  • Never cut power mid-deploy. Powering off during a deploy can corrupt the roboRIO filesystem and force a re-image. Wait for it to finish.

After a successful deploy, open the FRC Driver Station, enable in Teleop, and drive.

Practice without the full robot

You do not need a $5,000 competition robot to learn. The XRP and Romi are small, inexpensive desktop robots built specifically for practicing WPILib. Their projects run on your computer through the WPILib simulation framework instead of deploying to a roboRIO, so you can write real WPILib code and watch it move at your kitchen table. FIRST also offers a free XRP-based training course covering everything from variables up through command groups.

The fastest way to actually learn is to deploy something tiny, break it, and fix it. Start with the example tank-drive template, get the robot rolling, then add one feature at a time.

Ready to go deeper? Work through the full walkthroughs in the LearnFRC Programming department.

Spot an error or something out of date?Log in to suggest an edit

Keep reading

More from the pit

Learn every department of FRC — free

Structured lessons, quizzes, and team tools. Built by an FRC student, for the community.

394lessons
11departments
100%free
Browse the guides