LEDインジケーター#

導入#

led クラスを使用すると、V5 Brainは3線式ポートを使用して接続された発光ダイオード(LED)をオンまたはオフにすることができます。

緑色のVEX V5 LEDインジケーター。

クラスコンストラクタ#

led(
  triport::port &port );

クラスデストラクタ#

led オブジェクトを破棄し、関連するリソースを解放します。

virtual ~led();

パラメータ#

パラメータ

タイプ

説明

port

triport::port &

LEDインジケータが接続されている3線式ポートは、 Brain.ThreeWirePort.X または ExpanderName.Xのように記述され、 X はポート文字です (例: Brain.ThreeWirePort.A または Expander1.A)。

例#

// Create an led instance in Port A
led LEDA = led(Brain.ThreeWirePort.A);

メンバーの機能#

led クラスには、以下のメンバ関数が含まれています。

  • on — 指定された LED インジケータを点灯します。

  • off — 指定された LED インジケータをオフにします。

led メンバ関数を呼び出す前に、以下に示すように led インスタンスを作成する必要があります。

/* This constructor is required when using VS Code.
LED Indicator configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */

// Create an led instance in Port A
led LEDA = led(Brain.ThreeWirePort.A);

on#

指定されたLEDインジケーターを点灯します。

Available Functions
void on();

Parameters

この関数は引数を受け付けません。

Return Values

この関数は値を返しません。

Examples
// Turn on the LED
LEDA.on();

// Wait 2 seconds
wait(2, seconds);

// Turn off LED
LEDA.off();

off#

指定されたLEDインジケーターを消灯します。

Available Functions
void off();

Parameters

この関数は引数を受け付けません。

Return Values

この関数は値を返しません。

Examples
// Turn on the LED
LEDA.on();

// Wait 2 seconds
wait(2, seconds);

// Turn off LED
LEDA.off();