পটেনশিওমিটার#

ভূমিকা#

pot এবং potV2 ক্লাসগুলো পটেনশিওমিটারের সাথে ব্যবহৃত হয়, যা হলো এক প্রকার অ্যানালগ সেন্সর এবং এটি একটি ঘূর্ণায়মান শ্যাফটের কৌণিক অবস্থান পরিমাপ করে। একটি পটেনশিওমিটার তার অবস্থানের সমানুপাতিক একটি ভোল্টেজ আউটপুট দেয়।

পটেনশিওমিটারের সংস্করণভেদে এর শনাক্তযোগ্য ঘূর্ণনের পরিমাণ ভিন্ন হয়:

  • পটেনশিওমিটার - ২৫০ ডিগ্রি পর্যন্ত

  • পটেনশিওমিটার ভি২ - ৩৩০ ডিগ্রি (অবিচ্ছিন্ন)

VEX V5 পটেনশিওমিটার V1।

VEX V5 পটেনশিওমিটার V2।

পটেনশিওমিটার

পটেনশিওমিটার V2

পটেনশিওমিটার#

Class Constructors#

pot(
  triport::port &port );

Class Destructor#

pot অবজেক্টটি ধ্বংস করে এবং সংশ্লিষ্ট রিসোর্সগুলো মুক্ত করে।

~pot();

Parameters#

প্যারামিটার

প্রকার

বর্ণনা

port

triport::port &

পটেনশিওমিটারটি যে ৩-ওয়্যার পোর্টের সাথে সংযুক্ত থাকে, তা 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 (ডিফল্ট) — শতাংশ, ০ থেকে ১০০% পর্যন্ত।

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

ফেরত:

  • percentUnits ব্যবহার করার সময় একটি int32_t।

  • rotationUnits ব্যবহার করার সময় double যুক্ত হয়।

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);