Pneumatics#

Introduction#

The VEX IQ Brain can control the VEX IQ Pneumatic system using the pneumatics class. This class allows the Brain to control the pneumatic pump and extend or retract pneumatic cylinders.

Class Constructors#

pneumatics( 
  int32_t index );

Class Destructor#

Destroys the pneumatics object and releases associated resources.

~pneumatics();

Parameters#

Parameter

Type

Description

index

int32_t

The Smart Port that the Pneumatic Solenoid is connected to, written as PORTx, where x is the port number (for example, PORT1).

Example#

// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);

Member Functions#

The pneumatics class includes the following member functions:

  • extend — Extend a cylinder.

  • retract — Retract a cylinder.

  • pump_on — Turns the pneumatic pump on.

  • pump_off — Turns the pneumatic pump off.

  • pump — Turns the pneumatic pump on or off.

  • installed — Returns whether or not the solenoid is connected to the brain.

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

/* This constructor is required to use an
IQ Pneumatics Solenoid. Replace the values
as needed. */

// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);

extend#

Extends a pneumatic cylinder.

Available Functions
void extend( 
  cylinderType id );

Parameters

Parameter

Type

Description

id

cylinderType

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinderAll – Both cylinders

Return Values

This function does not return a value.

Examples
// Extend cylinder 1
Pneumatic1.extend(cylinder1);

// Extend all cylinders
Pneumatic1.extend(cylinderAll);

retract#

Retracts a pneumatic cylinder.

Available Functions
void retract( 
  cylinderType id );

Parameters

Parameter

Type

Description

id

cylinderType

The cylinder to retract:

  • cylinder1
  • cylinder2
  • cylinderAll – Both cylinders

Return Values

This function does not return a value.

Examples
// Retract cylinder 2
Pneumatic1.retract(cylinder2);

// Retract all cylinders
Pneumatic1.retract(cylinderAll);

pump_on#

Turns the pneumatic pump on.

Available Functions
void pump_on();

Parameters

This function does not have parameters.

Return Values

This function does not return a value.

Examples
// Turn the pneumatic pump on
Pneumatic1.pump_on();

pump_off#

Turns the pneumatic pump off.

Available Functions
void pump_off();

Parameters

This function does not have parameters.

Return Values

This function does not return a value.

Examples
// Turn the pneumatic pump off
Pneumatic1.pump_off();

pump#

Turns the pneumatic pump on or off.

Available Functions
void pump( 
  bool state );

Parameters

Parameter

Type

Description

state

bool

The state to set: true turns the pneumatic pump on. false turns the pneumatic pump off.

Return Values

This function does not return a value.

Examples
// Turn the pump on
Pneumatic1.pump(true);

// Turn the pump off
Pneumatic1.pump(false);

installed#

Returns whether the Pneumatic Solenoid is connected to the Brain.

Available Functions
bool installed();

Parameters

This function does not have parameters.

Return Values

Returns a Boolean indicating whether the solenoid is connected to the Brain or not.

  • true if the solenoid is connected to the Brain.

  • false if the solenoid is not connected to the Brain.

Examples
// Check if the pneumatic solenoid is connected
if (Pneumatic1.installed()) {
  // Pneumatic system is ready
  Pneumatic1.pump_on();
}