|
Re: Limit Switch Tripping
Quote:
Originally Posted by lokistormbringe
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.
|