SparkMax showing signal but not outputting

Hello, basically we’re really having problems with our SparkMaxs.

When we enable our code, the SparkMaxs should simply be set to a 50% percent output speed. However, instead, the SparkMaxs simply stay a solid magenta (indicating a valid signal, we are using NEOs). They do not show any signs of outputting. We just ran this same code 10 minutes ago and the SparkMaxs were working fine, but all of a sudden, the SparkMaxs are not responding to anything. This is the bare code we are using to test:

‘’

private static CANSparkMax leftSparkMaster, otherSparker;

@Override
public void robotInit() {
    leftSparkMaster = new CANSparkMax(4, CANSparkMaxLowLevel.MotorType.kBrushless);
    otherSparker = new CANSparkMax(2, CANSparkMaxLowLevel.MotorType.kBrushless);
}

@Override
public void robotPeriodic() {

}

@Override
public void disabledInit() {
}

@Override
public void disabledPeriodic() {
}

@Override
public void autonomousInit() {
}

@Override
public void autonomousPeriodic() {

}

@Override
public void teleopInit() {

}

@Override
public void teleopPeriodic() {
    System.out.println("RUNNING");
    leftSparkMaster.set(.5);
    otherSparker.set(.5);
}

@Override
public void testInit() {

}

@Override
public void testPeriodic() {

}

}
‘’

This should simply set the sparks to 50% but they instead do nothing, but indicate they have a valid signal. I see all my print statements running inside teleopPeriodic(), but the sparks just don’t move, despite the same code having worked 10 minutes ago.

Nothing electrically has changed between now and then, and the wiring appears to be fine. This was something sudden that happened we have no idea what to do to fix this issue.

We can see the SparkMaxs on the Rev Spark Client and we have blinked them to ensure that we have the right IDs in the code.

Any help would be very much appreciated.

I would start by calling restoreFactoryDefaults() on both motor controllers on init to be sure no flags have been erroneously set, like a current or output limit.

1 Like

The sparks do run now, however, if I try to adjust it to:

leftSparkMaster = new CANSparkMax(2, CANSparkMaxLowLevel.MotorType.kBrushless); otherSparker = new CANSparkMax(4, CANSparkMaxLowLevel.MotorType.kBrushless); leftSparkMaster.restoreFactoryDefaults(true); otherSparker.restoreFactoryDefaults(true);
otherSparker.follow(leftSparkMaster);

then the otherSparker SparkMax does not follow. It only runs when manually set to a speed. Instead of following, it simply just stays solid magenta

Appears to be fixed when I call restoreFactoryDefaults() with no parameters, instead of what I was doing before with setting restoreFactoryDefaults(True).

Thank you!

Sorry, I only saw this just now. Glad you got it!

Edit: using the boolean version burns the the factory settings to flash memory so that they persist on startup. Perhaps that caused a race condition, where it wrote factory settings to storage after receiving the follow command (@Will_Toth?)

This is quite possible. I would recommend calling burnFlash() after the other settings instead of passing true to the restoreFactoryDefaults() method.

1 Like

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