FIRST Robotics Competition Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Motor Control with Joystick Buttons Snippet

Whit-E_Wall-E
NI Employee (retired)

There are many ways to use a motor besides driving your robot around. However, if you're already using the the axes of the joystick to drive the robot you will need another way to control additional motors. In this snippet we control the motor using the MotorControl palette instead of the RobotDrive palette. We set button 1 to turn the motor on when you hold it down, and buttons 2 and 3 on the joystick to decrease and increase the speed respectively. With this we can use a motor to rotate another part of the robot, such as an arm.

Note: When you first press button 1 on the joystick the speed is set to zero. You will need to use buttons 2 and 3 to cause the robot to reverse or move forward.

For more basic motor control and infromation on setting up your system check out this online tutorial.

Joystick Button Motor Control.png

Regards,

M. Whitaker
ni.com/support