气动元件#
介绍#
The pneumatics class is used to control a VEX V5 Pneumatics device connected to a 3-Wire port.
它提供了激活电磁阀以伸缩气缸的方法。气动装置必须在代码中手动构建,不能使用 VEXcode V5 中的“设备菜单”添加。
类构造函数#
pneumatics( triport::port &port );
类析构函数#
Destroys the pneumatics object and releases associated resources.
~pneumatics();
参数#
范围 |
类型 |
描述 |
|---|---|---|
|
|
The 3-Wire Port the Pneumatic Solenoid is connected to, written as |
笔记#
该类只能通过代码手动构造,不能使用 VEXcode V5 中的设备菜单构造。
A Brain or 3-Wire Expander must be created first before they can be used to create an object with the
pneumaticsclass 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 pneumatics device to the solenoid open state allowing air to flow into the cylinder.close— Sets the pneumatics device to the solenoid close state stopping air 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 Functionsvoid open();
此函数不接受任何参数。
Return Values此函数不返回值。
Examples// Open the solenoid to extend the cylinder
PneumaticsA.open();
close#
将气动装置设置为电磁阀关闭状态,停止空气流入气缸。
Available Functionsvoid close();
此函数不接受任何参数。
Return Values此函数不返回值。
Examples// Close the solenoid to retract the cylinder
PneumaticsA.close();