數位輸出#

介紹#

數位輸出三線設備可讓EXP主機板向外部元件(例如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 EXP 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)