ระบบนิวแมติกส์#
การแนะนำ#
VEX IQ Brain สามารถควบคุม ระบบนิวแมติกของ VEX IQ โดยใช้คลาส pneumatics คลาสนี้ช่วยให้ 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();
}