Triport#
初始化 Triport 类#
Triport 或 3 线扩展器是使用以下构造函数创建的:
Triport(port)
此构造函数仅使用一个参数:
范围 |
描述 |
|---|---|
|
3 线扩展器连接到 EXP Brain 上的 端口。 |
# Construct a Triport object named expander_1 in Port 1.
expander_1 = Triport(Ports.PORT1)
This expander_1 object will be used in all subsequent examples throughout this API documentation when referring to Triport class methods.
Triports also have a letter attribute denoting the specific port in use. Each port is identified by a letter (a through h) and can be accessed using the format expander_1.x, where x is the port letter. For example, expander_1.a refers to the Sensor connected to the Triport’s port A.
类方法#
index()#
The index() method returns the index of the Triport.
**返回:**三端口的索引。
installed()#
The installed() method checks if the Triport is connected.
Returns: True if the Triport is connected. False if it not.
timestamp()#
The timestamp() method returns the timestamp of the last received status packet from the Triport.
**返回:**最后接收的状态包的时间戳(以毫秒为单位)。