デジタル出力#
導入#
digital_out クラスを使用すると、EXP Brainは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#
選択した3線式ポートの信号レベルを設定します。
Available Functionsvoid set(
bool value );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
高信号または低信号を送信するかどうか: |
この関数は値を返しません。
Examples// Set the Digital Output to true
DigitalOutA.set(true);
// Set the Digital Output to false
DigitalOutA.set(false);