Pneumatics#

Introduction#

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

Note: CTE Pneumatic commands require the CTE module. Import it using using namespace cte;.

Class Constructors#

pneumatic( 
  int32_t index );

Class Destructor#

Destroys the pneumatic object and releases associated resources.

~pneumatic();

Parameters#

Parameter

Type

Description

index

int32_t

The Smart Port that the CTE Pneumatic Solenoid is connected to (e.g., PORT1).

Notes#

  • CTE Pneumatic commands will only work with the CTE Pneumatic parts.

  • You must manually import the CTE module: using namespace cte;.

  • The system can control up to 4 cylinders individually or all at once.

Example#

using namespace cte;

// Create a CTE Pneumatic Solenoid in Port 1
pneumatic ctePneumatic1 = pneumatic(PORT1);

// Turn on the pump and extend cylinder 1
ctePneumatic1.pump_on();
ctePneumatic1.extend(cylinder1);

Member Functions#

extend#

Extends a pneumatic cylinder.

Available Functions
void extend( 
  cylinderType id );

Parameters

Parameter

Type

Description

id

cylinderType

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinder3
  • cylinder4
  • cylinderAll – All 4 cylinders

Return Values

This function does not return a value.

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

// Extend all cylinders
ctePneumatic1.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
  • cylinder3
  • cylinder4
  • cylinderAll – All 4 cylinders

Return Values

This function does not return a value.

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

// Retract all cylinders
ctePneumatic1.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
ctePneumatic1.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
ctePneumatic1.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
ctePneumatic1.pump(true);

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

installed#

Returns whether the CTE 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 (ctePneumatic1.installed()) {
  // Pneumatic system is ready
  ctePneumatic1.pump_on();
}