तनाव नापने का यंत्र#

परिचय#

पोटेंशियोमीटर pot और potV2 श्रेणियों का उपयोग पोटेंशियोमीटर के साथ किया जाता है, जो एक एनालॉग सेंसर है जो घूर्णनशील शाफ्ट की कोणीय स्थिति को मापता है। एक पोटेंशियोमीटर अपनी स्थिति के समानुपाती वोल्टेज आउटपुट करता है।

पोटेंशियोमीटर के प्रकार के आधार पर, यह जितनी घूर्णन गति का पता लगा सकता है, वह भिन्न होती है:

  • पोटेंशियोमीटर - 250 डिग्री तक

  • पोटेंशियोमीटर V2 - 330 डिग्री (निरंतर)

VEX EXP पोटेंशियोमीटर V1.

VEX EXP पोटेंशियोमीटर V2.

तनाव नापने का यंत्र

पोटेंशियोमीटर V2

तनाव नापने का यंत्र#

Class Constructors#

pot(
  triport::port &port );

Class Destructor#

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

~pot();

Parameters#

पैरामीटर

प्रकार

विवरण

port

triport::port &

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

Example#

// Create a pot instance in Port A
pot PotentiometerA = pot(Brain.ThreeWirePort.A);

पोटेंशियोमीटर V2#

Class Constructors#

potV2(
  triport::port &port );

Class Destructor#

potV2 ऑब्जेक्ट को नष्ट करता है और संबंधित संसाधनों को मुक्त करता है।

~potV2();

Parameters#

पैरामीटर

प्रकार

विवरण

port

triport::port &

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

Examples#

// Create a Potentiometer V2 on 3-Wire Port A
potV2 PotentiometerV2A = potV2(Brain.ThreeWirePort.A);

सदस्य कार्य#

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

  • angle — पोटेंशियोमीटर की कोणीय स्थिति को डिग्री में या प्रतिशत के रूप में लौटाता है।

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

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

// Create a potV2 instance in Port A
potV2 PotentiometerV2A = potV2(Brain.ThreeWirePort.A);

angle#

यह पोटेंशियोमीटर की कोणीय स्थिति लौटाता है।

1 — यह फ़ंक्शन कोण को प्रतिशत के रूप में दर्शाता है।

int32_t angle (
  percentUnits units = percentUnits::pct );

2 — यह फ़ंक्शन कोण को चयनित घूर्णन इकाइयों के रूप में दर्शाता है।

double angle(
  rotationUnits units );

Parameters

पैरामीटर

प्रकार

विवरण

units

percentUnits

वह इकाई जो पूर्ण घूर्णन के प्रतिशत के रूप में स्थिति को दर्शाती है: percent pct (डिफ़ॉल्ट) - प्रतिशत, 0 से 100% तक।

units

rotationUnits

The unit that represents the angle:

  • deg / degrees — degrees, from 0 to 250 for a Potentiometer or 0 to 330 for a Potentiometer V2
  • turns / rev — revolutions

Return Values

प्रतिफल:

  • An int32_t when using percentUnits.

  • A double जब rotationUnits का उपयोग कर रहे हों।

Examples
// Get the current angle of the Potentiometer V2 in the
// range 0 to 330 degrees.
double angle = PotentiometerV2A.angle(degrees);

// Print the current angle of the Potentiometer to the
// brain screen.
Brain.Screen.print(angle);