氣動元件#
介紹#
VEX EXP 控制器可以透過 pneumatic 氣動控制 CTE 氣動系統。此類控制允許控制器控制氣動泵並伸縮氣缸。
注意:CTE 氣動指令需要 CTE 模組。使用以下程式碼導入: using namespace cte;。
類別建構函數#
pneumatic(
int32_t index );
類別析構函數#
摧毀 pneumatic 物體並釋放相關資源。
~pneumatic();
參數#
範圍 |
類型 |
描述 |
|---|---|---|
|
|
CTE氣動電磁閥所連接的智慧型連接埠(例如,PORT1)。 |
筆記#
CTE氣動指令只能與CTE氣動部件配合使用。
您必須手動匯入 CTE 模組:
using namespace cte;。該系統可以單獨控制最多 4 個氣缸,也可以同時控制所有氣缸。
例子#
using namespace cte;
// Create a CTE Pneumatic Solenoid in Port 1
pneumatic ctePneumatic1 = pneumatic(PORT1);
// Turn on the pump and extend cylinder 1
ctePneumatic1.pump_on();
ctePneumatic1.extend(cylinder1);
成員功能#
extend#
伸出氣缸。
Available Functionsvoid extend(
cylinderType id );
範圍 |
類型 |
描述 |
|---|---|---|
|
|
要伸出的汽缸:
|
此函數不傳回值。
Examples// Extend cylinder 1
ctePneumatic1.extend(cylinder1);
// Extend all cylinders
ctePneumatic1.extend(cylinderAll);
retract#
縮回氣缸。
Available Functionsvoid retract(
cylinderType id );
範圍 |
類型 |
描述 |
|---|---|---|
|
|
要縮回的油缸:
|
此函數不傳回值。
Examples// Retract cylinder 2
ctePneumatic1.retract(cylinder2);
// Retract all cylinders
ctePneumatic1.retract(cylinderAll);
pump_on#
啟動氣動幫浦。
Available Functionsvoid pump_on();
此函數沒有參數。
Return Values此函數不傳回值。
Examples// Turn the pneumatic pump on
ctePneumatic1.pump_on();
pump_off#
關閉氣動幫浦。
Available Functionsvoid pump_off();
此函數沒有參數。
Return Values此函數不傳回值。
Examples// Turn the pneumatic pump off
ctePneumatic1.pump_off();
pump#
開啟或關閉氣動幫浦。
Available Functionsvoid pump(
bool state );
範圍 |
類型 |
描述 |
|---|---|---|
|
|
要設定的狀態: |
此函數不傳回值。
Examples// Turn the pump on
ctePneumatic1.pump(true);
// Turn the pump off
ctePneumatic1.pump(false);
installed#
返回 CTE 氣動螺線管是否與大腦連接。
Available Functionsbool installed();
此函數沒有參數。
Return Values返回一個布林值,指示螺線管是否連接到大腦。
true為螺線管與大腦連接時的值。false如果螺線管未連接到大腦。
// Check if the pneumatic solenoid is connected
if (ctePneumatic1.installed()) {
// Pneumatic system is ready
ctePneumatic1.pump_on();
}