数字输出#
介绍#
The digital_out class allows the V5 Brain to send a digital signal to an external component such as an LED, relay, or other electronic device. It can send a high signal (5 volts) or a low signal (0 volts).
类构造函数#
digital_out(
triport::port &port );
类析构函数#
Destroys the digital_out object and releases associated resources.
~digital_out();
参数#
范围 |
类型 |
描述 |
|---|---|---|
|
|
The 3-Wire Port that the Digital Output device is connected to, written as |
例子#
// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
成员功能#
The digital_out class includes the following member functions:
set— Sets the signal level of a 3-Wire Digital Out port to high or low.
Before calling any digital_out member functions, a digital_out instance must be created, as shown below:
/* 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 );
范围 |
类型 |
描述 |
|---|---|---|
|
|
Whether to send a high or low signal: |
此函数不返回值。
Examples// Set the Digital Output to true
DigitalOutA.set(true);
// Set the Digital Output to false
DigitalOutA.set(false);