Making Joystick buttons control moters

We where a rookie team last year, but we lost all of are programmers and the simple codes they made last year. I’m new to programing and but confused with some stuff. One thing I want to know is how you can program a motor so that when you press one button it makes the motor run one direction. But then when you press another button the motor moves the opposite direction. These motors are going to be used to raise and lower are arm and open and close the claw. Also we are planning on having victor speed controls hooked up to them is it any different to program them with the speed controls?

What program language are you using? In general you just have to check the button states and put a conditional statement in your tele-op code to set the motor speed.
be sure to cover the condition when both buttons are pressed a If else If statement is a good way to go.

We are using Labview this year for programing. So far I have been able to figure out how to control the drive motors with the joystick 2 axis. But now I want to make it so when I press and hold say button 2 on the joystick another motor moves on the robot one direction. The when I press and hold say button 3 that motor now moves the opposite direction then as before.

Here are two similar, common ways to do this in Labview. The first way uses two Select statements and allows you to later change the motor power in both directions if you decide you don’t want full power. You can also replace one of the select statements with a Boolean to Integer conversion.

Buttons2.jpg
Buttons.jpg


Buttons2.jpg
Buttons.jpg

I will give this a try and see if it does what i want it to. Thanks

Just got done with robotics meeting and this worked great just what I needed.

1 Like