Wpilib Programming help

Hello, my name is Dillon Cordes and I am with team 8422 the Husky Howlers. If anyone has any advice on programming a joystick button in the wpilib java based program to turn motors on and off that would be such a good help.

Have you seen the docs and examples?

sure have, just didn’t see a doc or example on that topic at all.

If you aren’t using the Command-Based Framework:

  • The MotorController basic example shows controlling a single motor with a joystick.
  • The Relay basic example shows controlling a relay with buttons.

You should be able to take what these two examples show you to do what you want.

If you are using the Command-Based Framework, which I personally recommend because I believe it helps write more structured and organized code:

I tend to like the GearsBot example as an example of a complete robot very similar to an FRC bot. For “simple” button-controls-motor, I’d look at what is going on with the Claw subsystem.

If you feel lost trying to figure out whats going on in a Command-Based example, perhaps take another look at the Docs for info on how Subsystems, Commands, and Command Scheduling work.