气动元件#

介绍#

VEX V5 控制器可以通过 pneumatics 控制 V5 气动系统。该类控制允许控制器打开或关闭系统,伸缩气缸。

气动装置必须在代码中手动构建,不能使用 VEXcode V5 中的设备菜单添加。

类构造函数#

pneumatics( 
  triport::port &port );

类析构函数#

摧毁 pneumatics 对象并释放相关资源。

~pneumatics();

参数#

范围

类型

描述

&port

triport::port

气动电磁阀连接的 3 线端口,写成 Brain.ThreeWirePort.X 或 ExpanderName.X,其中 X 是端口字母(例如, Brain.ThreeWirePort.A 或 Expander1.A)。

笔记#

  • 该类只能通过代码手动构造,不能使用 VEXcode V5 中的设备菜单构造。

  • 必须先创建大脑或 3 线扩展器,然后才能使用 pneumatics 类构造函数创建对象。

例子#

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

成员功能#

pneumatics 类包含以下成员函数:

  • open — 将气动电磁阀设置为打开状态,允许空气流入气缸。

  • close — 将气动电磁阀设置为关闭状态,阻止空气流入气缸。

在调用任何 pneumatics 成员函数之前,必须创建一个 pneumatics 实例,如下所示:

/* This constructor is required to use a
V5 Pneumatics Solenoid when not configured as
a Digital Out device. Replace the values
as needed. */

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

open#

将气动电磁阀设置为打开状态,允许空气流入气缸。

Available Functions
void open();

Parameters

此函数不接受任何参数。

Return Values

此函数不返回值。

Examples
// Open the solenoid to extend the cylinder
PneumaticsA.open();

close#

将气动电磁阀设置为关闭状态,阻止空气流入气缸。

Available Functions
void close();

Parameters

此函数不接受任何参数。

Return Values

此函数不返回值。

Examples
// Close the solenoid to retract the cylinder
PneumaticsA.close();