|
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
|