pros::adi::Gyro class

Constructors, destructors, conversion operators

Gyro(std::uint8_t adi_port, double multiplier = 1) explicit
Initializes a gyroscope on the given port.
Gyro(ext_adi_port_pair_t port_pair, double multiplier = 1) explicit
Initializes a gyroscope on the given port of an adi expander.

Public functions

double get_value() const
Gets the current gyro angle in tenths of a degree.
std::int32_t reset() const
Resets the gyroscope value to zero.
ext_adi_port_tuple_t get_port() const
Gets the port of the sensor.

Function documentation

ext_adi_port_tuple_t pros::adi::Gyro::get_port() const

Gets the port of the sensor.

Returns returns a tuple of integer ports.

Example

#define DIGITAL_SENSOR_PORT 1 // 'A'

void initialize() {
  pros::adi::AnalogIn sensor (DIGITAL_SENSOR_PORT);
  
     // Getting values from the tuple using std::get<index> 
     int sensorSmartPort = std::get<0>(sensor.get_port()); // First value
  int sensorAdiPort = std::get<1>(sensor.get_port()); // Second value

     // Prints the first and second value from the port tuple (The Adi Port. The first value is the Smart Port)
  printf("Sensor Smart Port: %d\n", sensorSmartPort);
  printf("Sensor Adi Port: %d\n", sensorAdiPort);   
}