FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

2 buttons to control one motor

HELP!

     I've been trying to get my motor, that will lift the robot, to go forward when button X is pressed and reverse when button Y is pressed. I've looked it up but what I find never works. I'm doing my programing in Labview 2010. Can someone please give me some tips?

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

The VIs you'll need are the ones to read the joystick values. Teleop calls Joystick Read to read some of the buttons as an example.

The next part is to call Motor Set Speed with one of three values, a positive one, a negative one, or zero if neither is pressed. There are many ways to choose between the values, but perhaps the simplest is to cascade two selectors as shown below. This says that if B1 is pressed, use -0.5, otherwise if B2 is pressed use 0.5, otherwise use 0.0.

You will also need to Open and store the motor reference in Begin and Close it in Finish. You'll need to get the motor reference by name in order to set the speed of course.

Greg McKaskle

0 Kudos
Message 2 of 2
(2,865 Views)