Log in

View Full Version : Multiple buttons on a single motor


Left Justified
28-01-2011, 18:30
Apologies if this seems like a stupid question, but:

My team decided to go with a traditional tankdrive for our bot, and I was wondering if it is possible to set multiple buttons to the same motor.

I was hoping to have the triggers on our joysticks make the motor driving the arm spin in opposite directions, and was having trouble figuring out how to do this.

Thanks in advance.

Alan Anderson
28-01-2011, 19:59
I'm sure what you are asking for is possible, and it's probably even easy. A more precise description of what you want would help. Do you want the left joystick trigger to run a motor in one direction and the right joystick trigger to run it in the other direction? Do you want the motor to stop when both triggers are released? Do you have any preference for what happens when both triggers are pressed?

bladetech932
28-01-2011, 20:08
Use the motor devref and just split the wire to go to two different set speed vis in two different case structures

Left Justified
29-01-2011, 13:28
I'm sure what you are asking for is possible, and it's probably even easy. A more precise description of what you want would help. Do you want the left joystick trigger to run a motor in one direction and the right joystick trigger to run it in the other direction? Do you want the motor to stop when both triggers are released? Do you have any preference for what happens when both triggers are pressed?


@Alan: I want pretty much what you said. I was hoping to have the left trigger make the motor go forward and the right trigger do the opposite.

Alan Anderson
30-01-2011, 10:56
I was right, what you want is easy.
9888
The triangular "Select" functions might be unfamiliar. The help describes them this way:
Returns the value wired to the t input or f input, depending on the value of s. If s is TRUE, this function returns the value wired to t. If s is FALSE, this function returns the value wired to f.

So when neither button is pressed, the motor is set to 0. When the forward button is pressed, the motor is set to 1 (full speed forward -- change the constant if you want some other speed). When only the reverse button is pressed, the motor is set to -1 (full speed reverse -- change it if you want).