class
#include <pros/adi.hpp>
Gyro
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); }