How do I change spark max idle mode in java

I’m trying to find a way to change the idle mode of the spark max during the teleop phase but I cannot find any resources to do so. I do know that the command CANSparkMax.setIdleMode() exists but I can’t find how to set it to brake or idle in java.

This may just be a simple thing but I just can’t find anything at all relating to it unless it’s through the REV Hardware Client.

Just call setIdleMode(IdleMode) on your instance of CANSparkMax and pass in the IdleMode value you want. Don’t forget the import.

import com.revrobotics.CANSparkMax.IdleMode;


The official javadocs are your friend here. Specifically, setIdleMode accepts a CANSparkMax.IdleMode object (well, enumerated value).

So yes, do exactly what @gdefender said, but definitely work on understanding how to read the javadocs going forward. They’re an invaluable resource.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.