Pneumatics#
Introduction#
The VEX V5 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 |
|---|---|---|
|
|
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#
The pneumatic 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 pneumatic member functions, a pneumatic instance must be created, as shown below:
using namespace cte;
/* This constructor is required to use a
CTE Pneumatic Solenoid. Replace the values
as needed. */
// Create the pneumatic instance on Port 1
pneumatic ctePneumatics1 = pneumatic(PORT1);
extend#
Extends a pneumatic cylinder.
Available Functionsvoid extend(
cylinderType id );
Parameter |
Type |
Description |
|---|---|---|
|
|
The cylinder to extend:
|
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 Functionsvoid retract(
cylinderType id );
Parameter |
Type |
Description |
|---|---|---|
|
|
The cylinder to retract:
|
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 Functionsvoid pump_on();
This function does not have parameters.
Return ValuesThis function does not return a value.
Examples// Turn the pneumatic pump on
ctePneumatic1.pump_on();
pump_off#
Turns the pneumatic pump off.
Available Functionsvoid pump_off();
This function does not have parameters.
Return ValuesThis function does not return a value.
Examples// Turn the pneumatic pump off
ctePneumatic1.pump_off();
pump#
Turns the pneumatic pump on or off.
Available Functionsvoid pump(
bool state );
Parameter |
Type |
Description |
|---|---|---|
|
|
The state to set: |
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 Functionsbool installed();
This function does not have parameters.
Return ValuesReturns a Boolean indicating whether the solenoid is connected to the Brain or not.
trueif the solenoid is connected to the Brain.falseif the solenoid is not connected to the Brain.
// Check if the pneumatic solenoid is connected
if (ctePneumatic1.installed()) {
// Pneumatic system is ready
ctePneumatic1.pump_on();
}