三线扩展器#

介绍#

3线扩展器允许V5主机通过单个智能端口连接增加8个额外的端口,从而支持更多的3线设备。

VEX V5 三线扩展器。

This page uses expander as the example 3-Wire Expander name. Replace it with your own configured name as needed.

以下是可用方法列表:

  • index – Returns an integer based on the Smart Port the 3-Wire Expander is connected to.

构造函数 – 手动初始化一个三线扩展器。

  • Triport – Create a 3-Wire Expander.

指数#

index returns an integer based on the Smart Port that the 3-Wire Expander is connected to. For example, if the 3-Wire Expander is connected to Port 1, index will return a 1.

Usage:
expander.index()

参数

描述

此方法没有参数。

构造函数#

Constructors are used to manually create Triport objects, which are necessary for configuring a 3-Wire Expander outside of VEXcode.

Triport#

Triport creates a 3-Wire Expander.

Usage:
Triport(smartport)

范围

描述

smartport

The Smart Port that the 3-Wire Expander is connected to, written as Ports.PORTx where x is the number of the port.

# Create a 3-Wire Expander in Port 10
expander = Triport(Ports.PORT10)

Each Triport object has 8 port attributes (a through h) that represent the ports on the 3-Wire Expander. These can be used in any other 3-Wire device’s constructor as an argument for the port parameter.

# Connect a Bumper Switch to the 3-Wire Expander
bumper_expanded_a = Bumper(expander.a)