气动#

初始化气动类#

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

The pneumatic constructor creates a pneumatic object in the specified Port.

范围

描述

port

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

pumpEnable

表示是否启用或禁用气泵的布尔值。

// Construct a Pneumatic System "Pneumatic" with the
// pneumatic class.
pneumatic Pnuematic = pneumatic(PORT1);

This Pneumatic 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.
Pneumatic.extend(cylinder1);

// Wait 2 seconds.
wait(2, seconds);

// Retract the first cylinder.
Pneumatic.retract(cylinder1);

retract()#

The retract(value) method retracts a cylinder.

参数

描述

价值

有效的 cylinderType

**返回:**无。

// Extend the first cylinder.
Pneumatic.extend(cylinder1);

// Wait 2 seconds.
wait(2, seconds);

// Retract the first cylinder.
Pneumatic.retract(cylinder1);

pumpOn()#

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

**返回:**无。

// Turn air pump on.
Pneumatic.pumpOn();

pumpOff()#

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

**返回:**无。

// Turn air pump off.
Pneumatic.pumpOff();

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.
Pneumatic.pump(true);

wait(3, seconds);

// Turn air pump off.
Pneumatic.pump(false);

timestamp()#

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

**返回:**最后一个状态包的时间戳,以毫秒为单位的无符号 32 位整数。

installed()#

The installed() method checks for device connection.

Returns: true if the device is connected. false if it is not.