Go to Post Let's not speak without knowing the "facts." If you say something please have valid reasonings behind it. =) - Arefin Bari [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-02-2014, 23:25
jls667 jls667 is offline
Registered User
None #2579
 
Join Date: Feb 2014
Location: ny
Posts: 25
jls667 is an unknown quantity at this point
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2014, 23:50
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: CIM programming question

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...
Code:
private Talon pickupMotor = new Talon(1);
...and then in your teleop code check the joystick buttons and set the Talon accordingly
Code:
// 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.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:30.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi