ระบบนิวแมติกส์#
การแนะนำ#
ตัวควบคุมหลักของ VEX EXP สามารถควบคุม ระบบนิวแมติก CTE โดยใช้คลาส pneumatic คลาสนี้ช่วยให้ตัวควบคุมหลักสามารถควบคุมปั๊มนิวแมติกและยืดหรือหดกระบอกสูบนิวแมติกได้
หมายเหตุ: คำสั่ง CTE Pneumatic ต้องการโมดูล CTE นำเข้าโดยใช้ using namespace cte;.
ตัวสร้างคลาส#
pneumatic(
int32_t index );
ตัวทำลายคลาส#
ทำลายวัตถุ pneumatic และปล่อยทรัพยากรที่เกี่ยวข้อง
~pneumatic();
พารามิเตอร์#
พารามิเตอร์ |
พิมพ์ |
คำอธิบาย |
|---|---|---|
|
|
พอร์ตอัจฉริยะที่โซลินอยด์นิวแมติก CTE เชื่อมต่ออยู่ (เช่น PORT1) |
หมายเหตุ#
คำสั่งควบคุมระบบลมของ CTE จะใช้งานได้เฉพาะกับชิ้นส่วนของ CTE Pneumatic เท่านั้น
คุณต้องนำเข้าโมดูล 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();
}