전위차계#
소개#
pot , potV2 클래스는 회전축의 각도 위치를 측정하는 아날로그 센서인 전위차계와 함께 사용됩니다. 전위차계는 위치에 비례하는 전압을 출력합니다.
전위차계 버전에 따라 감지할 수 있는 회전량이 다릅니다.
가변저항계 - 최대 250도
전위차계 V2 - 330도 (연속)
|
|
|---|---|
전위차계 |
전위차계 V2 |
전위차계#
Class Constructors#
pot(
triport::port &port );
Class Destructor#
pot 객체를 파괴하고 관련 리소스를 해제합니다.
~pot();
Parameters#
매개변수 |
유형 |
설명 |
|---|---|---|
|
|
가변저항기가 연결된 3선 포트는 |
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#
매개변수 |
유형 |
설명 |
|---|---|---|
|
|
가변저항기 V2가 연결된 3선 포트는 |
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 );
Parameters2 — 이 함수는 선택한 회전 단위로 각도를 나타냅니다.
double angle( rotationUnits units );
매개변수 |
유형 |
설명 |
|---|---|---|
|
|
전체 회전 대비 위치를 백분율로 나타내는 단위: |
|
|
The unit that represents the angle:
|
보고:
percentUnits을 사용할 때int32_t.double사용할 때rotationUnits이 됩니다.
// 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);

