Coding the V5 Pneumatics Kit

This guide is designed to help V5 Pneumatics Kit users navigate the process of understanding, configuring, and coding their pneumatics. For more information about the components within the V5 Pneumatics Kit, view this article from the VEX Library.

Control Options and Setup

In the V5 Pneumatics Kit, the Double Acting Solenoid and its accompanying Double Acting Solenoid Driver Cable play key roles in enabling users to control pneumatic systems via VEXcode V5.

To learn how the Solenoid works, view this article from the VEX Library.

Configuring the Solenoid

Since we have learned the Solenoid is just a 3-Wire device that we can change the state of, we will now add and configure the device in VEXcode V5.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their functions within the V5 robotics system.

Open VEXcode V5 and select the Devices button to open the Devices window.

Diagram illustrating V5 Pneumatic components, showcasing various parts and their connections for educational purposes in robotics.

Select ‘Add a device.’

Diagram illustrating VEX V5 Pneumatics system components, including air tanks, valves, and actuators, highlighting their arrangement and connections for educational purposes.

Select ‘3-WIRE.’

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their functions within the V5 robotics system.

After selecting ‘3-WIRE,’ select ‘DIGITAL OUT.’

Remember, we need to tell the Solenoid what state it should be in. To do this, we need to send information out through the 3-Wire, which is why we chose the Digital Out device.

Diagram illustrating VEX V5 Pneumatics system components, including cylinders, valves, and air tanks, used for robotic applications.

After selecting Digital Out, choose which 3-wire port you plugged the Solenoid Driver Cable into on your Robot Brain. Ports that are already configured for other devices will be unavailable.

Once the port has been selected, select ‘DONE’ to submit the device to the configuration or ‘CANCEL’ to return back to the Devices menu.

Note: Selecting ‘CANCEL’ will undo any changes you have made to the device and will not be a part of the configuration.

Diagram illustrating V5 pneumatic components and their connections, showcasing various parts used in VEX robotics for pneumatic systems.

After this, the 'Digital Out' Sensing commands have now appeared in the Sensing section.

The digital out commands change the state of the Solenoid:

Low - Flow of air to outlet A

High - Flow of air to outlet B

Diagram illustrating V5 Pneumatics components and their arrangement, showcasing various parts such as cylinders, valves, and connectors used in the VEX robotics system for enhanced functionality.

For more information about configuring 3-Wire Digital In and Digital Out devices in VEXcode V5 such as how to rename them, delete them from the configuration, or change their port number, view this article from the VEX Library.

Coding the Solenoid

Let's now explore an example of coding the solenoid using Blocks, Python, and C++ with a straightforward one-cylinder pneumatic system, which is depicted below. An example use case of this system could be to power a launcher mechanism. For more information on the components and assembly of this system, view this article from the VEX Library. For examples of a basic V5 Pneumatics System operation, view this article from the VEX Library.

Diagram illustrating the components and functionality of VEX V5 Pneumatics system, including various parts and their connections, designed to provide a clear understanding of the pneumatic mechanisms used in robotics.

VEXcode V5 Blocks VEXcode V5 Python
Diagram illustrating V5 Pneumatics components, showcasing various parts and their connections in a robotics system, highlighting the functionality and layout of pneumatic systems in VEX robotics.
digital_out_a.set(False)
VEXcode V5 C++
int main() 
{ DigitalOutA.set(false);
}

Using a one-cylinder pneumatic setup, this example will cause the cylinder to fully retract immediately, provided the Air Tank is pressurized and the Shut Off Valve Fitting is open.

Remember the default state for our solenoid is a low state (or 'false' with text coding), so this example will ensure our cylinder starts from a known position of being retracted.

VEXcode V5 Blocks VEXcode V5 Python
Diagram illustrating the components and setup of VEX V5 Pneumatics system, showcasing various parts and their connections for educational purposes in robotics.
digital_out_a.set(False)
wait(1, SECONDS)
digital_out_a.set(True)
VEXcode V5 C++
int main() 
{ DigitalOutA.set(false); wait(1, seconds); DigitalOutA.set(true); }

After the above example is executed and the program ends, the solenoid stays in the low state. By adding a 'DigitalOut' high state, or True code, the cylinder will first retract when the program starts and then fully extend after one second. If you stop the program at this point, the solenoid will revert back to the low state.

It is helpful to separate 'DigitalOut' commands using 'Wait' commands. This will allow a brief period of time for the Cylinder to extend or retract.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: