ดิจิทัลเอาท์#
การแนะนำ#
คลาส digital_out ช่วยให้ V5 Brain สามารถส่งสัญญาณดิจิทัลไปยังส่วนประกอบภายนอก เช่น LED รีเลย์ หรืออุปกรณ์อิเล็กทรอนิกส์อื่นๆ โดยสามารถส่งสัญญาณสูง (5 โวลต์) หรือสัญญาณต่ำ (0 โวลต์) ได้
ตัวสร้างคลาส#
digital_out(
triport::port &port );
ตัวทำลายคลาส#
ทำลายอ็อบเจ็กต์ digital_out และปล่อยทรัพยากรที่เกี่ยวข้อง
~digital_out();
พารามิเตอร์#
พารามิเตอร์ |
พิมพ์ |
คำอธิบาย |
|---|---|---|
|
|
พอร์ต 3 สายที่อุปกรณ์เอาต์พุตดิจิทัลเชื่อมต่ออยู่ เขียนเป็น |
ตัวอย่าง#
// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
ฟังก์ชันสมาชิก#
คลาส digital_out ประกอบด้วยฟังก์ชันสมาชิกต่อไปนี้:
set— ตั้งค่าระดับสัญญาณของพอร์ต Digital Out 3 สายเป็นสูงหรือต่ำ
ก่อนเรียกใช้ฟังก์ชันสมาชิก digital_out ใดๆ จะต้องสร้างอินสแตนซ์ digital_out ก่อน ดังแสดงด้านล่าง:
/* This constructor is required when using VS Code.
Digital output configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */
// Create the digital_out instance on 3-Wire Port A
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
set#
ตั้งค่าระดับสัญญาณของพอร์ต 3 สายที่เลือกไว้
Available Functionsvoid set(
bool value );
พารามิเตอร์ |
พิมพ์ |
คำอธิบาย |
|---|---|---|
|
|
เลือกว่าจะส่งสัญญาณสูงหรือสัญญาณต่ำ: |
ฟังก์ชันนี้ไม่ส่งค่ากลับ
Examples// Set the Digital Output to true
DigitalOutA.set(true);
// Set the Digital Output to false
DigitalOutA.set(false);