View Single Post
  #1   Spotlight this post!  
Unread 29-01-2016, 14:31
Sky Captain's Avatar
Sky Captain Sky Captain is offline
Lead Software Mentor
AKA: Will
FRC #0386 (Voltage)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2006
Location: Virginia
Posts: 18
Sky Captain is an unknown quantity at this point
Send a message via AIM to Sky Captain
Joystick Pneumatic Triggering

Hi all,

We're working on a method that when we hit a button on the joystick, we want 2 pneumatic cylinders to fire forward and stay forward until we hit the same button again at which point the cylinders will retract. So far however all we get is the cylinders to fire once and not retract. I'm sure we're pretty close, but just missing something small. We're using a boolean to make sure that we don't try to fire forward if they are already forward. Are we using everything correctly? Here's our pseudo code. All of this code is in the teleop periodic method.
Code:
boolean status = false;

if(joystick.getRawButton(3))
{
     if(status == false)
     {  
           solenoid.kforward();
           status = true;
     }
     else
     {
           solenoid.kreverse();
           status = false;
     }
}
__________________
When in doubt, check the documentation.

Last edited by Sky Captain : 29-01-2016 at 20:01. Reason: Fixing code formatting
Reply With Quote