View Single Post
  #7   Spotlight this post!  
Unread 16-02-2014, 21:37
Whippet's Avatar
Whippet Whippet is offline
MIT Class of 2020
AKA: Luis Trueba
FRC #4301 (New Tech Narcissists)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Cambridge, MA
Posts: 1,187
Whippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond repute
Send a message via Yahoo to Whippet
Re: Limit Switch Tripping

Quote:
Originally Posted by lokistormbringe View Post
We are using java. The current code runs the throwing arm at full until the top switch is hit and them slowly reverses it back into place
Alright. I'm not too good with Java, but I think the pseudocode for such an operation would look something like this:

Code:
if(stick.getRawButton(Trigger) == true){
arm.setSpeed(speed);
timer.Delay(time);
arm.setSpeed(0);
}
else {
arm.setSpeed(0);
}
where the variable Time is equal to how long your arm needs to be run, Speed is the power you are applying to your arm, and Trigger is the appropriate button on your joystick. Sorry if this is incorrect, I use LabVIEW and just started learning Java this weekend, but I *think* with some tweaking, this should be what you want.

EDIT: This is for a strictly timing-based solution like SenorZ suggested. I am as yet unsure of how to get the values from limit switches.
__________________
2010: FRC 3043, Build Assistant
2011: FRC 3043, Head of Minibot subteam; FLL 12762, Team Captain
2012: FRC 3043, Electrical; FLL 12762, Team Captain; FTC 5670, Team Captain
2013: FRC 4301, Electrical, Team Co-Captain
2014: FRC 4301, Electrical/Programming, Team Co-Captain
2015: FRC 4301, Electrical/Programming, Team Captain
2016: FRC 4301, Chief Technical Officer; FTC 10860, 10861, and 11004: Mentor. Winner, Hub City Regional (3310 & 4063)

Last edited by Whippet : 16-02-2014 at 21:41.
Reply With Quote