空気圧#
導入#
VEX IQ Brainは、 pneumatics クラスを使用してVEX IQ Pneumaticシステムを制御できます。このクラスにより、Brainは空気圧ポンプを制御し、空気圧シリンダーを伸縮させることができます。
クラスコンストラクタ#
pneumatics(
int32_t index );
クラスデストラクタ#
pneumatics オブジェクトを破壊し、関連するリソースを解放します。
~pneumatics();
パラメータ#
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
空気圧ソレノイドが接続されているスマートポートは、 |
例#
// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);
メンバーの機能#
pneumatics クラスには、以下のメンバ関数が含まれます。
extend— 円柱を拡張します。retract— シリンダーを収縮させます。pump_on— 空気圧ポンプをオンにします。pump_off— 空気圧ポンプをオフにします。pump— 空気圧ポンプのオン/オフを切り替えます。installed— ソレノイドが脳に接続されているかどうかを返します。
pneumatics メンバー関数を呼び出す前に、以下に示すように pneumatics インスタンスを作成する必要があります。
/* This constructor is required to use an
IQ Pneumatics Solenoid. Replace the values
as needed. */
// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);
extend#
空気圧シリンダーを伸長させる。
Available Functionsvoid extend(
cylinderType id );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
延長するシリンダー:
|
この関数は値を返しません。
Examples// Extend cylinder 1
Pneumatic1.extend(cylinder1);
// Extend all cylinders
Pneumatic1.extend(cylinderAll);
retract#
空気圧シリンダーを格納します。
Available Functionsvoid retract(
cylinderType id );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
引き込むシリンダー:
|
この関数は値を返しません。
Examples// Retract cylinder 2
Pneumatic1.retract(cylinder2);
// Retract all cylinders
Pneumatic1.retract(cylinderAll);
pump_on#
空気圧ポンプのスイッチを入れる。
Available Functionsvoid pump_on();
この関数には引数がありません。
Return Valuesこの関数は値を返しません。
Examples// Turn the pneumatic pump on
Pneumatic1.pump_on();
pump_off#
空気圧ポンプを停止します。
Available Functionsvoid pump_off();
この関数には引数がありません。
Return Valuesこの関数は値を返しません。
Examples// Turn the pneumatic pump off
Pneumatic1.pump_off();
pump#
空気圧ポンプのオン/オフを切り替えます。
Available Functionsvoid pump(
bool state );
パラメータ |
タイプ |
説明 |
|---|---|---|
|
|
設定する状態: |
この関数は値を返しません。
Examples// Turn the pump on
Pneumatic1.pump(true);
// Turn the pump off
Pneumatic1.pump(false);
installed#
空気圧ソレノイドがブレインに接続されているかどうかを返します。
Available Functionsbool installed();
この関数には引数がありません。
Return Valuesソレノイドがブレインに接続されているかどうかを示すブール値を返します。
trueソレノイドが脳に接続されている場合。falseソレノイドがブレインに接続されていない場合。
// Check if the pneumatic solenoid is connected
if (Pneumatic1.installed()) {
// Pneumatic system is ready
Pneumatic1.pump_on();
}