WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

InvenSense/ITG3200.h

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.
Since WebbotLib Version 1.28.
A breakout board is available from SparkFun: http://www.sparkfun.com/products/9801
That page also has a link to the complete datasheet.
Note that the device requires a supply in the range 2.1v to 3.6v and draws approximately 6.5mA. This voltage should be applied to both the VDD pin and VLOGIC pin (also called VIO).
The I2C address of the device can be configured to be either 0xD2 or 0xD0 depending on whether the AD0 pin is pulled high or low.
The CLK pin is not used and so should be connected to ground.
The INT output pin can be used to signal to your microprocessor when there is new data available. This is not supported by WebbotLib by default, ie WebbotLib always reads the current values, but you could always connect it to a digital input pin and use it to signal whether or not it is worth reading new values or not.
The remaining pins: SCL, SDA and GND form the I2C bus.
To create the device use:-
ITG3200 itg3200 = MAKE_ITG3200_At(0xD2); // or could be 0xD0
You will also need to add it to an I2C bus as shown in i2cBus.h
Don't forget that you should initialise the device in appInitHardware:-
gyroInit(itg3200);
You can read the device by using:
gyroRead(itg3200);
and then the results are in:-
itg3200.gyro.x_axis_degrees_per_second
itg3200.gyro.y_axis_degrees_per_second
itg3200.gyro.z_axis_degrees_per_second
itg3200.celsius

Valid XHTML 1.0 Transitional