Skip to content
Programming, Controls & Sensors·Lesson 14 of 51

REVLib: SPARK MAX / SPARK Flex with NEO and NEO Vortex

Control REV Robotics motors — the NEO and NEO Vortex via SPARK MAX / SPARK Flex — using the modern REVLib 2025 configuration API.

Sign in to track progress, earn XP, and save lessons.

The REV ecosystem

REV Robotics makes the NEO and NEO Vortex brushless motors, driven by the SPARK MAX and SPARK Flex motor controllers. Unlike the Talon FX, the controller and motor are separate (you wire a SPARK MAX to a NEO). They run on CAN and use the REVLib software library and the REV Hardware Client desktop app.

Install REVLib via "Manage Vendor Libraries" using REV's vendordep URL.

The 2025 configuration model

Starting with REVLib 2025, all SPARK classes moved into a com.revrobotics.spark package and configuration became declarative (similar in spirit to Phoenix 6). Instead of calling setters directly on the controller, you build a SparkMaxConfig (or SparkFlexConfig) and apply it:

import com.revrobotics.spark.SparkMax;
import com.revrobotics.spark.SparkBase;
import com.revrobotics.spark.SparkLowLevel.MotorType;
import com.revrobotics.spark.config.SparkMaxConfig;
import com.revrobotics.spark.config.SparkBaseConfig.IdleMode;

SparkMax motor = new SparkMax(2, MotorType.kBrushless); // CAN ID 2, NEO

SparkMaxConfig config = new SparkMaxConfig();
config.idleMode(IdleMode.kBrake);
config.smartCurrentLimit(40);

motor.configure(config,
    SparkBase.ResetMode.kResetSafeParameters,
    SparkBase.PersistMode.kPersistParameters);

ResetMode/PersistMode control whether old settings are wiped and whether the config survives a power cycle.

Open-loop control

The simplest output is percent power:

motor.set(0.5); // 50% output

Closed-loop control

Configure PID gains under the config's closedLoop member, then command the on-board controller through getClosedLoopController(). In REVLib 2025 the controller class was renamed from SparkPIDController to SparkClosedLoopController, and its setpoint method is setSetpoint(...) (the old setReference(...) still exists but is deprecated):

config.closedLoop
    .feedbackSensor(FeedbackSensor.kPrimaryEncoder)
    .pid(0.1, 0.0, 0.0);
motor.configure(config, ResetMode.kResetSafeParameters, PersistMode.kPersistParameters);

// Run on-board velocity control to 1000 RPM
motor.getClosedLoopController().setSetpoint(1000, ControlType.kVelocity);

REV's on-board smooth-motion feature is MAXMotion (configured under closedLoop.maxMotion with parameters like cruise velocity and max acceleration), commanded with control types such as kMAXMotionPositionControl.

Reading the encoder

The NEO/NEO Vortex have built-in encoders read through the SPARK:

RelativeEncoder enc = motor.getEncoder();
double position = enc.getPosition(); // rotations
double velocity = enc.getVelocity(); // RPM

In REVLib 2025, read-back parameter getters live on a configAccessor field rather than on the controller directly.

REV Hardware Client

Use the REV Hardware Client to set CAN IDs, update firmware, and test motors on the bench. As with CTRE, every device on the CAN bus needs a unique ID.

CTRE vs. REV at a glance

CTRE Talon FXREV SPARK MAX/Flex
MotorKraken X60/X44 / Falcon 500 (integrated)NEO / NEO Vortex (separate)
LibraryPhoenix 6REVLib
ConfigTalonFXConfiguration + applySparkMaxConfig + configure
CommandsetControl(request)set() / getClosedLoopController().setSetpoint()

Many teams mix both. The patterns rhyme: configure declaratively, then either set open-loop output or command the on-board closed-loop controller.

Key takeaways

  • REV's NEO / NEO Vortex motors are driven by separate SPARK MAX / SPARK Flex controllers.
  • REVLib 2025 uses declarative config: build SparkMaxConfig, then motor.configure(...).
  • Open-loop is motor.set(value); closed-loop uses getClosedLoopController().setSetpoint() (setReference is deprecated).
  • Configure PID under config.closedLoop; MAXMotion provides on-board smooth motion.
  • Use the REV Hardware Client to set unique CAN IDs and update firmware.

Lesson quiz

Required

Answer all 3 questions correctly to complete this lesson.

1.Out of the box, what motor mode does the REV SPARK MAX default to, and what can it drive?

2.How does the NEO Vortex physically connect to the REV SPARK Flex motor controller?

3.What is the default Smart Current Limit setting on a REV SPARK MAX?

Answer every question to submit.