Triport#
为了使 Triport 命令在 VEXcode V5 中可用,必须在设备窗口中配置 3 线扩展器。
有关详细信息,请参阅以下文章:
初始化 Triport 类#
Triport 或 3 线扩展器是使用以下构造函数创建的:
Triport(port)
此构造函数仅使用一个参数:
范围 |
描述 |
---|---|
|
3 线扩展器连接到 V5 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’s sensor.
**返回:**从 Triport 传感器接收到的最后一个状态包的时间戳(以毫秒为单位)。