气动#

介绍#

气动系统使用气泵和电磁阀来控制移动气缸的压缩空气。它可以通过代码打开或关闭气泵,并伸缩气缸。

This page uses Pneumatic1 as the example Pneumatic System name. Replace it with your own configured name as needed.

以下是可用方法的列表:

动作——用气泵压缩或减压空气。

  • extend – Extend a cylinder.

  • retract – Retract a cylinder.

  • pumpOn – Turn on the air pump.

  • pumpOff – Turn off the air pump.

  • pump – Set the on or off state of the air pump.

吸气剂 – 检查螺线管是否连接。

  • installed – Returns whether or not a solenoid is connected to the Brain.

构造函数——手动初始化和配置气动装置。

行动#

extend#

extend extends a cylinder.

Usage:
Pneumatic1.extend(id);

参数

描述

id

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinderALL – Both cylinders

retract#

retract retracts a cylinder.

Usage:
Pneumatic1.retract(id);

参数

描述

id

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinderALL – Both cylinders

pumpOn#

pumpOn turns the air pump on.

Usage:
Pneumatic1.pumpOn();

参数

描述

该方法没有参数。

pumpOff#

pumpOff turns the air pump off.

Usage:
Pneumatic1.pumpOff();

参数

描述

该方法没有参数。

pump#

pump turns the air pump on or off.

Usage:
Pneumatic1.pump(state);

参数

描述

state

The air pump state:

  • true – Turn the air pump on.
  • false – Turn the air pump off.

吸气剂#

installed#

installed returns a Boolean indicating whether the solenoid is connected to the Brain.

  • 1 - The solenoid is connected to the Brain.

  • 0 - The solenoid is not connected to the Brain.

Usage:
Pneumatic1.installed()

参数

描述

该方法没有参数。

构造函数#

pneumatic#

pneumatic creates an object of the pneumatic Class in the specified port.

Default Usage:
pneumatic Pneumatic1 = pneumatic(smartport);

Overload Usages:
pneumatic Pneumatic1 = pneumatic(smartport, bPumpEnable);

范围

描述

smartport

The Smart Port that the Pneumatic Solenoid is connected to, written as PORTx where x is the number of the port.

bPumpEnable

A Boolean representing whether to enable or disable the air pump:

  • true – The air pump is set to on at the start of a project.
  • false – The air pump is set to off at the start of the project.
    int main() {
      // Initializing Robot Configuration. DO NOT REMOVE!
      vexcodeInit();
    
      // Create a Pneumatics object in Port 3
      pneumatic myPneumatic = pneumatic(PORT3);
    
      // Create another in Port 4 that starts with pump enabled
      pneumatic PumpOnPneumatic = pneumatic(PORT4, true);
    }