You will just need to set the value of the pneumatic to one position while the button is being pressed, and the other when it is not.
Psuedocode:
Code:
if (A button is pressed) {
pneumatic.set(on);
} else {
pneumatic.set(off);
}
Java Single Solenoid:
Code:
Solenoid solenoid = new Solenoid(port);
if (operator.getRawButton(1)) {//example
solenoid.set(true);
} else {
solenoid.set(false);
}
Java Single Solenoid:
Code:
DoubleSolenoid solenoid = new DoubleSolenoid(portA, portB);
if (operator.getRawButton(1)) {
solenoid.set(DoubleSolenoid.Value.kForward);
} else {
solenoid.set(DoubleSolenoid.Value.kReverse);
}
getRawButton(1) should be mapped to the A button on Xbox controllers. Switch it to getRawButton(2) for Logitech controllers.