气动元件#

介绍#

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;.

类构造函数#

pneumatic( 
  int32_t index );

类析构函数#

Destroys the pneumatic object and releases associated resources.

~pneumatic();

参数#

范围

类型

描述

index

int32_t

CTE气动电磁阀所连接的智能端口(例如,PORT1)。

笔记#

  • CTE气动指令只能与CTE气动部件配合使用。

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

  • 该系统可以单独控制最多 4 个气缸,也可以同时控制所有气缸。

例子#

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);

成员功能#

extend#

伸出气缸。

Available Functions
void extend( 
  cylinderType id );

Parameters

范围

类型

描述

id

cylinderType

The cylinder to extend:

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

Return Values

此函数不返回值。

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

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

retract#

缩回气缸。

Available Functions
void retract( 
  cylinderType id );

Parameters

范围

类型

描述

id

cylinderType

The cylinder to retract:

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

Return Values

此函数不返回值。

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

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

pump_on#

启动气动泵。

Available Functions
void pump_on();

Parameters

此函数没有参数。

Return Values

此函数不返回值。

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

pump_off#

关闭气动泵。

Available Functions
void pump_off();

Parameters

此函数没有参数。

Return Values

此函数不返回值。

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

pump#

开启或关闭气动泵。

Available Functions
void pump( 
  bool state );

Parameters

范围

类型

描述

state

bool

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

Return Values

此函数不返回值。

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

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

installed#

返回 CTE 气动螺线管是否与大脑连接。

Available Functions
bool installed();

Parameters

此函数没有参数。

Return Values

返回一个布尔值,指示螺线管是否连接到大脑。

  • 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();
}