数字输出#

介绍#

数字输出三线设备允许V5主控单元向外部元件(例如LED、继电器或其他电子设备)发送数字信号。它可以发送高电平信号(5伏)或低电平信号(0伏)。

本页面使用 dig_out 作为示例数字输出设备名称。请根据需要将其替换为您自己配置的名称。

以下是可用方法列表:

  • set – 将 3 线数字输出端口的信号电平设置为高或低。

构造函数 – 手动初始化和配置数字输出设备。

  • DigitalOut – 创建一个数字输出设备。

放#

set 设置所选 3 线端口的信号电平。

Usage:
dig_out.set(boolean)

范围

描述

boolean

是否发送高电平或低电平信号: True 发送高电平信号(5V), False 发送低电平信号(0V)。

# Send out a low signal from dig_out
dig_out.set(False)

构造函数#

构造函数用于手动创建 DigitalOut 对象,这是在 VEXcode 之外配置 Digital Out 设备所必需的。

DigitalOut#

DigitalOut 创建一个数字输出设备。

Usage:
DigitalOut(port)

范围

描述

port

The 3-Wire Port that the Digital Out device is connected to:

  • On the V5 Brain – brain.three_wire_port.x where x is the number of the port.
  • On a 3-Wire Expander – expander.a where expander is the name of the expander instance.

# Create a Digital Out device in Port A
dig_out = DigitalOut(brain.three_wire_port.a)