This is our teams first time using pneumatics. We have everything hooked up but are having issues with the programming part using LabVIEW. We would like the piston to extend when button “A” is pressed and retract when button “A” is released. How would we achieve this. Thanks in advance!
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:
if (A button is pressed) {
pneumatic.set(on);
} else {
pneumatic.set(off);
}
Java Single Solenoid:
Solenoid solenoid = new Solenoid(port);
if (operator.getRawButton(1)) {//[example](https://github.com/TexasTorque/TexasTorque2015/blob/master/src/org/texastorque/texastorque2015/input/DriverInput.java#L41)
solenoid.set(true);
} else {
solenoid.set(false);
}
Java Single Solenoid:
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.
How about in LabVIEW?
Sorry, my team has only used C++ and Java. Here are a few links that might be helpful:
http://www.team476.com/wpimages/wp1798b5a5_05_06.jpg
I hope this helps!
Like so:
http://i.imgur.com/pZL3xaO.png
In the false state of the case structure in Teleop, the solenoid must be set to reverse instead of forward. Additionally, in Begin, make sure your PCM ID and solenoid channels match how you wired your robot; the forward channel is the channel wired to the end of the solenoid connected to the part of the piston further from the rod, while the reverse channel should be set to the closer end. If you’re unsure, just guess and switch it if it’s backwards.