FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Motor Control - Forward & Reverse with Buttons

The documentation Joystick Button Control (Using a Functional Global Variable)  helped us get started, but now we are stuck implementing forward/backward. We have restricted the limits of the reverse case to 0, -1 and the limits of the forward case to 1, 0. But when using the reverse button, we only slow down continued forward motion to a stop. No reverse motion is ever intiated. We could post our vi, but not clear how to do that. Thanks for any help or ideas. Team 2145

0 Kudos
Message 1 of 2
(4,110 Views)

You did not explain just what you needed in the way of what happens when you press a button.

This snippit of code will read the joystick button.

As long as button 1 only is press the motor will run forward.

As long as button 2 only is pressed the motor will run reverse

If no button is pressed the motor will stop.

If both buttons are pressed the motor will stop.

You will need to fill in some of the missing parts like references to your joystick and motor.

If you need more than this reply back.

Omar
Message 2 of 2
(2,725 Views)