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.


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


Select ‘Add a device.’


Select ‘3-WIRE.’


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.


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.


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


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.


VEXcode V5 Blocks VEXcode V5 Python
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
wait(1, SECONDS)
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: