Hello everyone! I’ve been coding some old robots recently to learn FRC coding and I’m using the 2025 beta version that uses the SparkMax class. I can’t figure out how to set idle modes through code in java. Most things say to use the setIdleMode method, however I can’t find it. Any help is appreciateed.
REV redid their API for 2025. Check the new config process.
I can’t find an example on how to use this at the moment.
Here’s some relevant discussion on the 2025 beta repository:
This looks like a possible way to set it
SparkMax motor_ = new SparkMax(0, SparkLowLevel.MotorType.kBrushless);
SparkMaxConfig config_ = new SparkMaxConfig();
config_.idleMode(SparkBaseConfig.IdleMode.kBrake);
motor_.configure(config_, SparkBase.ResetMode.kResetSafeParameters, SparkBase.PersistMode.kPersistParameters)
This example use a motor of ID 0 and expects a Brushless motor. Make sure to change this to match your setup. I just picked random values for the Reset and Persist Mode. Look at what Jonah shared above to decide what to use.
FYI: There may be a better way to do this, but I haven’t looked much into the new REV API.