Defining a motor is the first step in any FRC robot program. Before you can spin a wheel, run an intake, or extend a mechanism, you need to declare the correct hardware class in Java and assign it a unique CAN ID or PWM port. This lesson walks you through the import statement and field declaration for three of the most common FRC motor controllers: the REV SPARK MAX (NEO), the CTRE Kraken (TalonFX), and the CIM motor via PWMSparkMax.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Holden9607/FRC-Academy/llms.txt
Use this file to discover all available pages before exploring further.
Lesson Overview
What you’ll write:- 1 import statement (or a small set of imports) for the motor controller class
- 1 field declaration that creates the hardware object as a class member
- The correct import path for each motor controller vendor library
- The class name to use:
SparkMax,TalonFX, orPWMSparkMax - The difference between a CAN ID (network-addressed controllers) and a PWM port (direct roboRIO pin)
- How to pass the right constructor arguments for each motor type
Solutions by Motor Type
- NEO (SparkMax)
- Kraken (TalonFX)
- CIM (PWMSparkMax)
The REV SPARK MAX uses the
SparkMax class from REVLib. You must specify MotorType.kBrushless to tell the controller it is driving a brushless NEO motor.Key Concepts
CAN ID A unique integer assigned to each motor controller on the CAN bus. Every device on the bus must have a distinct ID — no two controllers can share the same number. FRC Academy uses ID1 by default. You configure CAN IDs using each vendor’s hardware client (REV Hardware Client or CTRE Phoenix Tuner X).
PWM Port
A 0-based integer index corresponding to a physical PWM output header on the roboRIO. PWM controllers like PWMSparkMax do not use the CAN bus at all — they receive analog pulse-width signals directly. FRC Academy uses port 0 for single-motor PWM lessons.
MotorType.kBrushless
This enum value tells the SPARK MAX that the attached motor is brushless (a NEO or NEO 550). Using the wrong motor type can damage the motor or controller, so always double-check this setting.
Bus name ("DINO")
CTRE Phoenix 6 devices can communicate over a dedicated CANivore USB-to-CAN adapter instead of the roboRIO’s built-in CAN bus. The bus name is a team-assigned string identifier for that adapter. FRC Academy uses "DINO" — your team may use a different name, or omit the second argument entirely to use the roboRIO bus.
In FRC Academy
To reach this lesson in the app:In FRC Academy, all robot code lives in a
Robot class that extends TimedRobot. Motor fields are declared at the class level so they are accessible from both robotInit() and teleopPeriodic(). The private final modifiers ensure the motor object is created once and cannot be reassigned.Activate a Motor →
Lesson 2 — Bind a controller button to run your motor at 50% speed using
whileTrue and onFalse.Motors Overview
Compare NEO, Kraken, and CIM motor controllers side by side.