pros::v5::literals namespace

Contents

Functions

const pros::Distance pros::v5::literals::operator""_dist(const unsigned long long int d)
Constructs a Distance sensor object from a literal ending in _dist via calling the constructor.
const pros::Gps pros::v5::literals::operator""_gps(const unsigned long long int g)
Constructs a Gps object with the given port number.
const pros::Imu pros::v5::literals::operator""_imu(const unsigned long long int i)
Constructs a Imu from a literal ending in _imu via calling the constructor.
const pros::Motor pros::v5::literals::operator""_mtr(const unsigned long long int m)
Constructs a Motor from a literal ending in _mtr.
const pros::Motor pros::v5::literals::operator""_rmtr(const unsigned long long int m)
Constructs a reversed Motor from a literal ending in _rmtr.
const pros::Optical pros::v5::literals::operator""_opt(const unsigned long long int o)
Constructs a Optical sensor from a literal ending in _opt.
const pros::Rotation pros::v5::literals::operator""_rot(const unsigned long long int r)
Constructs a Rotation sensor from a literal ending in _rot.

Function documentation

const pros::Distance pros::v5::literals::operator""_dist(const unsigned long long int d)

Constructs a Distance sensor object from a literal ending in _dist via calling the constructor.

Returns a pros::Distance for the corresponding port

Example

using namespace pros::literals;
void opcontrol() {
 pros::Distance dist = 2_dist; //Makes an dist object on port 2
}

const pros::Gps pros::v5::literals::operator""_gps(const unsigned long long int g)

Constructs a Gps object with the given port number.

Example

using namespace literals;

void opcontrol() {
     pros::Gps gps = 1_gps;
  while (true) {
    pos = gps.get_position();
    screen_print(TEXT_MEDIUM, 1, "X Position: %4d, Y Position: %4d", pos.x, pos.y);
    delay(20);
  }
}

const pros::Optical pros::v5::literals::operator""_opt(const unsigned long long int o)

Constructs a Optical sensor from a literal ending in _opt.

Returns a pros::Optical for the corresponding port

Example

using namespace pros::literals;
void opcontrol() {
 pros::Optical opt = 2_opt; //Makes an Optical object on port 2
}

const pros::Rotation pros::v5::literals::operator""_rot(const unsigned long long int r)

Constructs a Rotation sensor from a literal ending in _rot.

Returns a pros::Rotation for the corresponding port

Example

using namespace pros::literals;
void opcontrol() {
 pros::Rotation rotation = 2_rot; //Makes an Motor object on port 2
}