数字输出#
介绍#
digital_out 类允许 V5 主控模块向外部组件(例如 LED、继电器或其他电子设备)发送数字信号。它可以发送高电平信号(5 伏)或低电平信号(0 伏)。
类构造函数#
digital_out(
triport::port &port );
类析构函数#
销毁 digital_out 对象并释放相关资源。
~digital_out();
参数#
范围 |
类型 |
描述 |
|---|---|---|
|
|
数字输出设备连接的 3 线端口,写成 |
例子#
// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
成员功能#
digital_out 类包含以下成员函数:
set— 将 3 线数字输出端口的信号电平设置为高或低。
在调用任何 digital_out 函数之前,必须先创建一个 digital_out ,如下所示:
/* This constructor is required when using VS Code.
Digital output configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */
// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
set#
设置所选三线端口的信号电平。
Available Functionsvoid set(
bool value );
范围 |
类型 |
描述 |
|---|---|---|
|
|
是否发送高电平或低电平信号: |
此函数不返回值。
Examples// Set the Digital Output to true
DigitalOutA.set(true);
// Set the Digital Output to false
DigitalOutA.set(false);