ระบบนิวแมติกส์#

การแนะนำ#

VEX IQ Brain สามารถควบคุม ระบบนิวแมติกของ VEX IQ โดยใช้คลาส pneumatics คลาสนี้ช่วยให้ Brain สามารถควบคุมปั๊มนิวแมติกและยืดหรือหดกระบอกสูบนิวแมติกได้

ตัวสร้างคลาส#

pneumatics( 
  int32_t index );

ตัวทำลายคลาส#

ทำลายวัตถุ pneumatics และปล่อยทรัพยากรที่เกี่ยวข้อง

~pneumatics();

พารามิเตอร์#

พารามิเตอร์

พิมพ์

คำอธิบาย

index

int32_t

พอร์ตอัจฉริยะที่โซลินอยด์แบบนิวแมติกเชื่อมต่ออยู่ จะเขียนในรูปแบบ PORTxโดยที่ x คือหมายเลขพอร์ต (ตัวอย่างเช่น PORT1)

ตัวอย่าง#

// Create the pneumatics instance on Port 1
pneumatics Pneumatic1 = pneumatics(PORT1);

ฟังก์ชันสมาชิก#

คลาส pneumatics ประกอบด้วยฟังก์ชันสมาชิกต่อไปนี้:

  • extend — ขยายทรงกระบอก

  • retract — ดึงกระบอกสูบกลับ

  • pumpOn — Turns the pneumatic pump on.

  • pumpOff — Turns the pneumatic 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 Functions
void extend( 
  cylinderType id );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

id

cylinderType

กระบอกสูบที่จะยืดออก:

  • cylinder1
  • cylinder2
  • cylinderAll – ทั้งสองกระบอกสูบ

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Extend cylinder 1
Pneumatic1.extend(cylinder1);

// Extend all cylinders
Pneumatic1.extend(cylinderAll);

retract#

ดึงกระบอกสูบแบบนิวแมติกกลับ

Available Functions
void retract( 
  cylinderType id );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

id

cylinderType

กระบอกสูบที่จะหดกลับ:

  • cylinder1
  • cylinder2
  • cylinderAll – ทั้งสองกระบอกสูบ

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Retract cylinder 2
Pneumatic1.retract(cylinder2);

// Retract all cylinders
Pneumatic1.retract(cylinderAll);

pumpOn#

เปิดใช้งานปั๊มลม

Available Functions
void pumpOn();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pneumatic pump on
Pneumatic1.pumpOn();

pumpOff#

ปิดปั๊มลม

Available Functions
void pumpOff();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pneumatic pump off
Pneumatic1.pumpOff();

pump#

เปิดหรือปิดปั๊มลม

Available Functions
void pump( 
  bool state );

Parameters

พารามิเตอร์

พิมพ์

คำอธิบาย

state

bool

สถานะที่จะตั้งค่า: true เปิดปั๊มลม false ปิดปั๊มลม

Return Values

ฟังก์ชันนี้ไม่ส่งค่ากลับ

Examples
// Turn the pump on
Pneumatic1.pump(true);

// Turn the pump off
Pneumatic1.pump(false);

installed#

ตรวจสอบว่าโซลินอยด์แบบนิวแมติกเชื่อมต่อกับตัวควบคุมหลักหรือไม่

Available Functions
bool installed();

Parameters

ฟังก์ชันนี้ไม่มีพารามิเตอร์

Return Values

ส่งคืนค่าบูลีนที่ระบุว่าโซลินอยด์เชื่อมต่อกับตัวควบคุมหลักหรือไม่

  • true ถ้าโซลินอยด์เชื่อมต่อกับสมอง

  • false ถ้าโซลินอยด์ไม่ได้เชื่อมต่อกับสมอง

Examples
// Check if the pneumatic solenoid is connected
if (Pneumatic1.installed()) {
  // Pneumatic system is ready
  Pneumatic1.pumpOn();
}