Pneumatics#

Introduction#

The pneumatics class is used to control a VEX V5 Pneumatics device connected to a 3-Wire port.

It provides methods for activating a solenoid to extend or retract a pneumatic cylinder. The Pneumatics device must be manually constructed in code and cannot be added using the Device Menu in VEXcode V5.

Class Constructors#

pneumatics( triport::port &port );

Class Destructor#

Destroys the pneumatics object and releases associated resources.

~pneumatics();

Parameters#

Parameter

Type

Description

&port

triport::port

The 3-Wire Port the Pneumatic Solenoid is connected to, written as Brain.ThreeWirePort.X or ExpanderName.X, where X is the port letter (for example, Brain.ThreeWirePort.A or Expander1.A).

Notes#

  • This class can only be constructed manually in code, as it cannot be constructed using the Device Menu in VEXcode V5.

  • A Brain or 3-Wire Expander must be created first before they can be used to create an object with the pneumatics class constructor.

Example#

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

Member Functions#

The pneumatics class includes the following member functions:

  • open — Sets the pneumatics device to the solenoid open state allowing air to flow into the cylinder.

  • close — Sets the pneumatics device to the solenoid close state stopping air flowing into the cylinder.

Before calling any pneumatics member functions, a pneumatics instance must be created, as shown below:

/* This constructor is required to use a
V5 Pneumatics Solenoid when not configured as
a Digital Out device. Replace the values
as needed. */

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

open#

Sets the pneumatics device to the solenoid open state allowing air to flow into the cylinder.

Available Functions
void open();

Parameters

This function does not take any parameters.

Return Values

This function does not return a value.

Examples
// Open the solenoid to extend the cylinder
PneumaticsA.open();

close#

Sets the pneumatics device to the solenoid close state stopping air flowing into the cylinder.

Available Functions
void close();

Parameters

This function does not take any parameters.

Return Values

This function does not return a value.

Examples
// Close the solenoid to retract the cylinder
PneumaticsA.close();