Sparkmax controller via PWM

Does anyone have example code for controlling a motor open loop via spark max using PWM?

The arcade example with PWM from Rev’s github seems like the best starting point.

1 Like

I looked at the examples and doesn’t seem to help bridge my gap of understanding.

This is what we have and it should be working but no movement.

I’d be more interested in seeing what you did in the Begin VI instead of the Teleop. That’s how you’re going to connect to the motor controllers.

Also what kind of motor are you connecting to the SparkMax?

And yes need to see how you are opening the controller in Begin.vi

Uploading: PXL_20220408_174353013.jpg…

Here is begin.

Fyi…at Jackson FIM and helping a rookie team and so it has been years since I used spark max and tried PWM.

One motor is a neo

The picture isn’t uploading. Something worth asking while we wait for that to resolve. If you have this setup similar to the Rev examples with the correct PWM options, do you see any LED changes on the Spark Max devices when you enable the robot, use the joystick, etc?

Other one is blinking orange

One of the controllers has the encoder from the motor plugged in but the other doesn’t.

If the controller is controlling a NEO the encoder needs to be plugged in because it’s brushless.

Also make sure the controller the configured for brushless if it is controlling a NEO

Status Light Quick Reference — FIRST Robotics Competition documentation. You can scroll down to get the status for the LEDs and what they mean.

Looking at the screenshot, you’re using “Victor” Open VIs. Is there a reason for that?

We swapped them to run on CAN. All working now.

1 Like

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