View Full Version : CIM programming question
I plan on connecting a CIM motor on my pickup device. I will probably use a talon. What method is best to use in order to run the CIM? I will probably program one button to make the CIM go in one direction and another for the other direction.
Domenic Rodriguez
07-02-2014, 23:50
The code for this task varies depending on what template you are using: SimpleRobot, IterativeRobot, or Command Based. If you're using SimpleRobot or IterativeRobot, just add a Talon to your robot class...
private Talon pickupMotor = new Talon(1);
...and then in your teleop code check the joystick buttons and set the Talon accordingly
// inside operatorControl() or teleopPeriodic()
// assuming there is already a Joystick object named 'joystick'
if (joystick.getRawButton(1))
pickupMotor.set(1.0);
else if (joystick.getRawButton(2))
pickupMotor.set(-1.0);
else
pickupMotor.set(0.0);
With the Command Based pattern, you'll want to add the Talon to your pickup subsystem, create a command(s) to set the motor, and then bind your commands to buttons in the OI class.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.