线路跟踪器#
介绍#
The line class is used to measure reflectivity detected by the Line Tracker.
类构造函数#
line(
triport::port &port );
类析构函数#
Destroys the line object and releases associated resources.
virtual ~line();
参数#
范围 |
类型 |
描述 |
|---|---|---|
|
|
The 3-Wire Port that the Line Tracker is connected to, written as |
示例#
// Create a line instance in Port A
line LineTrackerA = line(Brain.ThreeWirePort.A);
成员功能#
The line class includes the following member functions:
reflectivity— Returns the reflectivity detected by the Line Tracker.
Before calling any line member functions, a line instance must be created, as shown below:
/* This constructor is required when using VS Code.
Line Tracker configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */
// Create a line instance in Port A
line LineTrackerA = line(Brain.ThreeWirePort.A);
reflectivity#
返回由线路跟踪器测量的反射率。
Available Functionsint32_t reflectivity(
percentUnits units = percentUnits::pct );
范围 |
类型 |
描述 |
|---|---|---|
|
|
The unit that represents the reflectivity:
|
Returns an int32_t representing the reflectivity measured by the Line Tracker as a percent in the range 0 - 100%.
// Display the detected reflectivity
int32_t value = LineTrackerA.reflectivity();
Brain.Screen.print(value);