How to control a single motor with a single motor controller

Hey guys just looking for advice on how to program a single motor controller to run off of two buttons (one to make the motor spin forwards one to make it spin backwards). I am using FRCvs Code and our robot is command based. Any advice would be greatly appreciated.

Are you using c++ or java? What motor controllers are you using (Spark, SparkMax, Talon, Victor)?

we are using victors and I am using java code if i am not mistaken.

There are several types of victors. Does yours look like this picture?
image

Are you using PWM or CAN to send signal from the Rio to the victor?

that is the one i am using and we are using a pwm connection

If you are using a command based code you will need to make a new subsystem. And set up your motor controller. Then make a method that can set the input to your motor controller.

Then in the RobotContainer link a button to run a command using that method. I do not have wpilib on my computer that I am on and will not till later this evening.

Look at the wpilib examples and see if you can figure anything out.

If you are still struggling and nothing is working for you I can help better this evening.

Make a command to run the motor forward, make a command to run the motor backwards, make a command that stops the motor

Here’s our intake code (RobotContainer)

Look at lines 84, 85, 86 and 96, 97, 98

That’s how we spin our motor forwards and backwards using two different buttons

what software did you use to right your code?

write*

Java, using the command-based template

https://docs.wpilib.org/en/latest/docs/software/commandbased/index.html

i am using command based s well just making sure