Coding the IQ Pneumatics Kit

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

Important Update Notice: Make sure the firmware on your IQ Robot Brain and Pneumatic Control Unit is up to date. Using outdated firmware could result in unexpected behavior and performance issues with the pneumatic components. To learn how to update your firmware, view the "Firmware" Section in the VEX Library, ensuring you follow the instructions specific to your IQ generation control system.

Control Options and Setup

In the IQ Pneumatics Kit, the Pneumatic Solenoid plays a key role in enabling users to control pneumatic systems via VEXcode IQ.

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

Configuring the Solenoid

As with motors and sensors, the Pneumatic Solenoid must be configured in VEXcode IQ before it can be used.


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


Select ‘Add a device.’




After selecting ‘PNEUMATIC,’ choose which port you plugged the Pneumatic Solenoid into 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.

Pneumatic original.png

After selecting ‘DONE,’ an image of the preconfigured Pneumatic Solenoid will appear.

The diagram shows the default configuration. We connect 'A' from the Pneumatic Solenoid to 'A' on the Cylinder, and 'B' to 'B'. This way, we can set our code to either ‘extend’ or ‘retract,’ because the ports on the Cylinders are connected to the matching ports on the Pneumatic Solenoid.

Cylinder 2 reversed.png

VEXcode IQ has a feature in the configuration menu that lets you reverse your setups. So, even if your tubing is not connected as default, the extend and retract commands will match the operation of your robot.

Once satisfied with the wiring configuration, select ‘DONE’ to close the device menu and begin coding.

Coding the Pneumatic Solenoid

Let's now explore an example of coding the Pneumatic 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.


VEXcode IQ Blocks VEXcode IQ Python
VEXcode IQ C++
int main() 
{ Pneumatic12.pumpOn();
Pneumatic12.retract(cylinder1); }

Using a one-cylinder pneumatic setup shown previously, this example will cause the cylinder to fully retract immediately because of the powered on Air Pump.

Turning on the Air Pump before using the cylinder is crucial, as it provides the cylinder with the required air pressure. As long as you want your system to maintain air pressure, the Air Pump should remain on. Including a code to retract the cylinder is a typical safety feature. This way, your cylinder always starts from the same known spot (retracted) every time. When your code completes, the Pneumatic Solenoid will remain in the last position that you instructed it to move to.

VEXcode IQ Blocks VEXcode IQ Python
image (38).png
wait(1, SECONDS)
VEXcode IQ C++
int main() 
{ Pneumatic12.pumpOn();
wait(1, seconds);
Pneumatic12.extend(cylinder1); }

After running the previous example and stopping the program, the Pneumatic Solenoid stays in the retracted state. If you add an 'extend' command, the cylinder will first retract when the program begins, and then fully extend after one second. If you stop the program here, the solenoid will stay in the 'extended' state.

By using the 'Wait' commands between the retract and extend actions you allow time for the cylinder to complete its movement.

This forms the basic foundation for controlling pneumatics using VEXcode IQ. Remember that controlling your pneumatic system is a blend of 'extend' and 'retract' commands. Understanding how and why these actions occur is important. Combined with your customized pneumatic setup, these commands allow you to precisely control your system, making it behave exactly as you want.


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

Last Updated: