气动元件#
介绍#
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.
类构造函数#
pneumatics(
int32_t index );
类析构函数#
Destroys the pneumatics object and releases associated resources.
~pneumatics();
参数#
范围 |
类型 |
描述 |
|---|---|---|
|
|
The Smart Port that the Pneumatic Solenoid is connected to, written as |
例子#
// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);
成员功能#
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#
伸出气缸。
Available Functionsvoid extend(
cylinderType id );
范围 |
类型 |
描述 |
|---|---|---|
|
|
The cylinder to extend:
|
此函数不返回值。
Examples// Extend cylinder 1
Pneumatic1.extend(cylinder1);
// Extend all cylinders
Pneumatic1.extend(cylinderAll);
retract#
缩回气缸。
Available Functionsvoid retract(
cylinderType id );
范围 |
类型 |
描述 |
|---|---|---|
|
|
The cylinder to retract:
|
此函数不返回值。
Examples// Retract cylinder 2
Pneumatic1.retract(cylinder2);
// Retract all cylinders
Pneumatic1.retract(cylinderAll);
pump_on#
启动气动泵。
Available Functionsvoid pump_on();
此函数没有参数。
Return Values此函数不返回值。
Examples// Turn the pneumatic pump on
Pneumatic1.pump_on();
pump_off#
关闭气动泵。
Available Functionsvoid pump_off();
此函数没有参数。
Return Values此函数不返回值。
Examples// Turn the pneumatic pump off
Pneumatic1.pump_off();
pump#
开启或关闭气动泵。
Available Functionsvoid pump(
bool state );
范围 |
类型 |
描述 |
|---|---|---|
|
|
The state to set: |
此函数不返回值。
Examples// Turn the pump on
Pneumatic1.pump(true);
// Turn the pump off
Pneumatic1.pump(false);
installed#
返回气动电磁阀是否与大脑连接。
Available Functionsbool installed();
此函数没有参数。
Return Values返回一个布尔值,指示螺线管是否连接到大脑。
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 (Pneumatic1.installed()) {
// Pneumatic system is ready
Pneumatic1.pump_on();
}