डिजिटल आउट#

परिचय#

digital_out क्लास EXP ब्रेन को एलईडी, रिले या अन्य इलेक्ट्रॉनिक उपकरण जैसे बाहरी घटक को डिजिटल सिग्नल भेजने की अनुमति देता है। यह उच्च सिग्नल (5 वोल्ट) या निम्न सिग्नल (0 वोल्ट) भेज सकता है।

क्लास कंस्ट्रक्टर#

digital_out(
  triport::port &port );

क्लास डिस्ट्रक्टर#

यह digital_out ऑब्जेक्ट को नष्ट करता है और उससे जुड़े संसाधनों को मुक्त करता है।

~digital_out();

पैरामीटर#

पैरामीटर

प्रकार

विवरण

port

triport::port &

3-वायर पोर्ट जिससे डिजिटल आउटपुट डिवाइस जुड़ा है, उसे Brain.ThreeWirePort.X या ExpanderName.Xके रूप में लिखा जाता है, जहाँ X पोर्ट अक्षर है (उदाहरण के लिए, Brain.ThreeWirePort.A या Expander1.A)।

उदाहरण#

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

सदस्य कार्य#

digital_out क्लास में निम्नलिखित सदस्य फ़ंक्शन शामिल हैं:

  • set — 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 Functions
void set(
  bool value );

Parameters

पैरामीटर

प्रकार

विवरण

value

bool

उच्च या निम्न सिग्नल भेजना है या नहीं: true उच्च सिग्नल (5V) भेजता है, और false निम्न सिग्नल (0V) भेजता है।

Return Values

इस कार्य पर कीमत के लिहाज से कुछ भी रिटर्न नहीं मिलता है।

Examples
// Set the Digital Output to true
DigitalOutA.set(true);

// Set the Digital Output to false
DigitalOutA.set(false);