气动元件#

介绍#

The VEX V5 Brain can control a V5 Pneumatics system using the pneumatics class. This class allows the Brain to open or close the system, extending or retracting pneumatic cylinders.

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

类构造函数#

pneumatics( 
  triport::port &port );

类析构函数#

Destroys the pneumatics object and releases associated resources.

~pneumatics();

参数#

范围

类型

描述

&port

triport::port

The 3-Wire Port the Pneumatic Solenoid is connected to, written as Brain.ThreeWirePort.X or ExpanderName.X, where X is the port letter (for example, Brain.ThreeWirePort.A or Expander1.A).

笔记#

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

  • A Brain or 3-Wire Expander must be created first before they can be used to create an object with the pneumatics class constructor.

例子#

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

成员功能#

The pneumatics class includes the following member functions:

  • open — Sets the Pneumatic Solenoid to the open state, allowing air to flow into the cylinder.

  • close — Sets the Pneumatic Solenoid to the close state, stopping air from flowing into the cylinder.

Before calling any pneumatics member functions, a pneumatics instance must be created, as shown below:

/* 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();