The REV NEO is one of the most popular brushless motors in FRC, prized for its compact size and high efficiency. It is controlled through the SPARK MAX motor controller over a CAN bus connection, and requires the REV Robotics vendor library to be installed in your WPILib project. Unlike PWM-based controllers, the CAN interface gives you access to telemetry, current limiting, encoder data, and configuration persistence — all from code.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.
Hardware Requirements
Before writing any code, make sure you have the following hardware and software ready:- SPARK MAX motor controller (REV-11-2158) wired to your CAN bus
- NEO brushless motor (REV-21-1650) connected to the SPARK MAX
- CAN bus connection from the SPARK MAX to the roboRIO (or through a CAN chain)
- REV Robotics vendor library installed in your WPILib project (via the WPILib VS Code extension or
vendordepsfolder)
Required Imports
Add these imports at the top of yourRobot.java file to access the SPARK MAX hardware class and motor type enumeration:
vendordeps folder.
Defining a NEO Motor
Declare and instantiate aSparkMax object inline as a private final field inside your Robot class. The constructor takes two arguments: the CAN ID and the motor type.
- CAN ID
1is the default used in all FRC Academy lessons. On a real robot, every motor controller must have a unique CAN ID. MotorType.kBrushlesstells the SPARK MAX that a brushless NEO (not a brushed CIM) is connected.
CAN ID
1 is used in FRC Academy lessons by default. In a real robot project, assign unique CAN IDs to each motor controller using the REV Hardware Client before deploying code.Inverting a Motor (for Tank Drive)
In a two-motor drivetrain, the left and right motors face opposite directions. Without inversion, both motors spin the same way and the robot spins in a circle instead of driving straight. For the SPARK MAX, inversion is applied through aSparkMaxConfig object — not a simple method call.
You will need three additional imports:
robotInit(), configure and apply inversion to the right motor:
ResetMode.kResetSafeParameters clears any previously stored settings before applying the new ones, and PersistMode.kPersistParameters saves the configuration to the SPARK MAX’s flash memory so it survives a power cycle.
Setting Motor Speed
Use the.set(double speed) method to command the motor to a speed. The value must be between -1.0 and 1.0, where:
1.0= full speed forward0.0= stop-1.0= full speed reverse
Available Lessons
FRC Academy includes four hands-on coding lessons for the NEO motor. Each lesson builds on the previous one, starting with a simple motor declaration and progressing to a full four-motor arcade drivetrain.1. Define a Motor
Declare and instantiate a
SparkMax object with CAN ID 1 and MotorType.kBrushless.2. Activate a Single Motor
Bind a motor to the operator controller’s B button using
whileTrue and onFalse command bindings.3. 2 Motor Tank Drive
Add a left and right motor, invert the right side using
SparkMaxConfig, and implement arcade drive in teleopPeriodic().4. 4 Motor Tank Drive
Extend to four motors using follower configuration with
SparkMaxConfig.follow() and a DifferentialDrive object.