气动#

气动命令仅适用于 CTE 气动部件。

初始化气动类#

使用以下构造函数创建气动系统:

Pneumatic(port)

此构造函数使用一个参数:

范围

描述

port

与气动电磁阀连接的有效 智能端口

# Construct a Pneumatic System "pneumatic_1" with the
# Pneumatic class.
pneumatic_1 = Pneumatic(Ports.Port1)

This pneumatic_1 object will be used in all subsequent examples throughout this API documentation when referring to Pneumatic class methods.

类方法#

extend()#

The extend(value) method extends a cylinder.

参数

描述

价值

有效的 CylinderType

**返回:**无。

# Extend the first cylinder.
pnuematic_1.extend(CYLINDER1)

# Wait 2 seconds.
wait(2, SECONDS)

# Retract the first cylinder.
pnuematic_1.retract(CYLINDER1)

retract()#

The retract(value) method retracts a cylinder.

参数

描述

价值

有效的 CylinderType

**返回:**无。

# Extend the first cylinder.
pnuematic_1.extend(CYLINDER1)

# Wait 2 seconds.
wait(2, SECONDS)

# Retract the first cylinder.
pnuematic_1.retract(CYLINDER1)

pump_on()#

The pump_on() method turns the pneumatic air pump on.

**返回:**无。

# Turn air pump on.
pnuematic_1.pump_on()

pump_off()#

The pump_off() method turns the pneumatic air pump off.

**返回:**无。

# Turn air pump off.
pnuematic_1.pump_off()

pump()#

The pump(state) method turns the pneumatic air pump on or off.

参数

描述

状态

The compressor state. True to turn it on. False to turn it off.

**返回:**无。

# Turn air pump on.
pnuematic_1.pump(True)

# Turn air pump off.
pnuematic_1.pump(False)

status()#

The status() method returns the raw status for the pneumatic device.

**返回:**气动装置的原始状态(整数)。

installed()#

The installed() method checks for device connection.

Returns: True if the device is connected. False if it is not.

timestamp()#

The timestamp() method returns the timestamp of the last received status packet from the Pneumatic System.

**返回:**最后接收的状态包的时间戳(以毫秒为单位)。