Pneumatics#

Introduction#

The pneumatic class provides control for the CTE Pneumatic system, which uses an air pump and solenoid to control compressed air for moving cylinders. This class enables precise control of pneumatic actuators in automated workcell applications.

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 air 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 on the air pump
ctePneumatic1.pump_on();

pump_off#

Turns the air 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 off the air pump
ctePneumatic1.pump_off();

pump#

Controls the air pump state.

Available Functions
void pump( 
  bool state );

Parameters

Parameter

Type

Description

state

bool

The air pump state:

  • true – Turn the air pump on
  • false – Turn the air 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();
}