पीडब्ल्यूएम आउट#

परिचय#

pwm_out क्लास का उपयोग VEX V5 3-वायर पोर्ट पर PWM (पल्स विड्थ मॉड्यूलेशन) आउटपुट को नियंत्रित करने के लिए किया जाता है। यह उपकरणों को संगत 3-वायर घटकों को परिवर्तनीय चौड़ाई वाले पल्स सिग्नल भेजने की अनुमति देता है।

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

pwm_out(
  triport::port &port );

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

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

~pwm_out();

पैरामीटर#

पैरामीटर

प्रकार

विवरण

port

triport::port &

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

उदाहरण#

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

सदस्य कार्य#

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

  • state — पी.डब्ल्यू.एम. आउटपुट की स्थिति निर्धारित करता है।

किसी भी pwm_out सदस्य फ़ंक्शन को कॉल करने से पहले, एक pwm_out इंस्टेंस बनाना आवश्यक है, जैसा कि नीचे दिखाया गया है:

/* This constructor is required when using VS Code.
PWM configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */

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

state#

यह PWM आउटपुट की स्थिति को एक निर्दिष्ट मान पर सेट करता है।

Available Functions
void state(
  int32_t      value,
  percentUnits units );

Parameters

पैरामीटर

प्रकार

विवरण

value

int32_t

PWM आउटपुट के लिए निर्धारित किया जाने वाला नया मान -100 से +100 प्रतिशत तक है।

units

percentUnits

The unit used to represent the PWM value: percent / pct — percent

Return Values

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

Notes
  • PWM आउटपुट मान -100 से +100 प्रतिशत तक होता है।

  • पीडब्ल्यूएम आउटपुट के लिए एकमात्र मान्य इकाई percent है।

Examples
// Set the PWM Output to 50%
pwm.state(50, percent);

// Set the PWM Output to -75%
pwm.state(-75, percent);