Gyros normally come in either 2 axis, or 3 axis versions. Sometimes you can buy a combo board that contains gyro and, say, an accelerometer. I don't directly support these combos so you need to declare the two individual sensors.
So what do they do? Gyros measure rotational velocity in degrees per second. This could be used to monitor whether a robot biped is falling over, so that you can compensate, or if measuring the rotation of an axle then, knowing the wheel circumference, you can work out the current speed of the robot.
These devices either use one ADC pin for each axis, or provide an I2C interface but you will need to check the individual data sheets to see what power supply they need.
All gyros return one value per axis and this value is in 'degrees per second'. Each value may be positive or negative and a two axis device will set the Z value to zero.
Assuming you have called the gyro 'myGyro' in Project Designer then:-
// Read the gyro and save the values
// Retrieve the x,y,z values
GYRO_TYPE x = myGyro.getX();
GYRO_TYPE y = myGyro.getY();
GYRO_TYPE z = myGyro.getZ();
// Print them out
cout << "X=" << x << " Y=" << y << " Z=" << z;
// Or dump it out
cout << myGyro;
Project Designer supports the following devices
- The IDG300 is a 2 axis gyro that can measure rotations up to 500 degrees per second.
- The IDG500 is a 2 axis gyro that can measure rotations up to 500 degrees per second.
- ITG3200 3 axis Gyro
- The ITG3200 is a 3 axis gyro that can measure rotations up to 2,000 degrees per second via an I2C interface. It also contains a temperature sensor.
- LPR530AL 2 axis
- The LPR530AL is a 2 axis gyro that can measure rotations up to 1200 degrees per second in the x and y axes.
- LY530AL 1 axis
- The LY530AL is a single axis gyro that can measure yaw rotations up to 1200 degrees per second.
- LPR530AL 2 axis plus LY530ALH 1 axis
- This is a combination (in software as there is no single device) of the LPR530AL 2 axis device and LY530ALH 1 axis device into a logical 3 axis gyro.