My team’s robot has pneumatics in it, and we are trying to use them during the auton part of a match. How do I create a function to do this?
1 Like
See these VEX Library articles, they should explain how to use pneumatics.
1 Like
Here is a great source vex has. Take the principle of using set digital out to high or low and put it in autonomous code.
V5 pro:
Configure the pneumatic in the devices config screen
piston.set(true);
piston.set(false);
V5 PROS
// Declare on a global scope
pros::ADIPort pneumatics('A', pros::adi_port_config_e::E_ADI_DIGITAL_OUT);
// Redefine in a local scope
void opcontrol()
{
pros::ADIDigitalOut pneumatics('A');
pneumatics.set_value(true);
pneumatics.set_value(false);
}
This might not be the most optimal way, but it’s what worked for me last year.
It depends if you’re using C++ or Python
For C++
/*
Assuming you have already made a 'Digitalout' device
and are using the web version of VexCodeV5.
*/
DigitalOutA.set(true);
// True extends the pneumatic, false retracts it.
// Initializing for Visual Studio Code:
digital_out Pneumatic1 = digital_out(Brain.ThreeWirePort.A);
//Replace 'Pneumatic1' with whatever you want to name it.
Python:
# True extends, false retracts.
# Make sure to add a digital out device if using web version
digout.set(True)
// Initializing for Visual Studio Code:
digout = DigitalOut(brain.three_wire_port.a)
1 Like
I realized I had to just put a set of parentheses by the function, and I couldn’t delete the post since it was pending… I figured it out though!
5 Likes
Make sure you mark a reply as your solution!
1 Like