氣動元件#

介紹#

VEX V5 控制器可透過 pneumatics 控制 V5 氣動系統。此類控制允許控制器打開或關閉系統,伸縮氣缸。

氣動裝置必須在代碼中手動構建,不能使用 VEXcode V5 中的設備選單添加。

類別建構函數#

pneumatics( 
  triport::port &port );

類別析構函數#

摧毀 pneumatics 對象並釋放相關資源。

~pneumatics();

參數#

範圍

類型

描述

&port

triport::port

氣動電磁閥連接的 3 線端口,寫成 Brain.ThreeWirePort.X 或 ExpanderName.X,其中 X 是端口字母(例如, Brain.ThreeWirePort.A 或 Expander1.A)。

筆記#

  • 此類別只能透過代碼手動構造,不能使用 VEXcode V5 中的設備選單構造。

  • 必須先建立大腦或 3 線擴展器,才能使用 pneumatics 類建構函數建立物件。

例子#

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

成員功能#

pneumatics 類別包含以下成員函數:

  • open — 將氣動電磁閥設定為開啟狀態,讓空氣流入汽缸。

  • close — 將氣動電磁閥設定為關閉狀態,阻止空氣流入汽缸。

在呼叫任何 pneumatics 成員函數之前,必須建立一個 pneumatics 實例,如下所示:

/* This constructor is required to use a
V5 Pneumatics Solenoid when not configured as
a Digital Out device. Replace the values
as needed. */

// Create the pneumatics instance on 3-Wire Port A
pneumatics PneumaticsA = pneumatics(Brain.ThreeWirePort.A);

open#

將氣動電磁閥設定為開啟狀態,讓空氣流入汽缸。

Available Functions
void open();

Parameters

此函數不接受任何參數。

Return Values

此函數不傳回值。

Examples
// Open the solenoid to extend the cylinder
PneumaticsA.open();

close#

將氣動電磁閥設定為關閉狀態,阻止空氣流入汽缸。

Available Functions
void close();

Parameters

此函數不接受任何參數。

Return Values

此函數不傳回值。

Examples
// Close the solenoid to retract the cylinder
PneumaticsA.close();