ITG 3200 Gyroscope
The ITG-3200 is a triple-axis, digital output gyroscope. It features three 16-bit analog-to-digital converters (ADCs) for digitizing the gyro outputs, a user-selectable internal low-pass filter bandwidth, and a Fast-Mode I2C (400kHz) interface, as well as an embedded temperature sensor and a 2% accurate internal oscillator.
Hello World!¶
Import program
00001 #include "ITG3200.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 ITG3200 gyro(p9, p10); 00005 00006 int main() { 00007 00008 pc.printf("Now starting ITG-3200 test...\n"); 00009 00010 //Set highest bandwidth. 00011 gyro.setLpBandwidth(LPFBW_42HZ); 00012 00013 while (1) { 00014 00015 //Arbitrary wait for printf clarity. 00016 wait(0.1); 00017 pc.printf("%i, %i, %i\n", gyro.getGyroX(), 00018 gyro.getGyroY(), gyro.getGyroZ()); 00019 00020 } 00021 00022 }
Wiring¶
ITG-3200 Signal Name | mbed pin |
VCC | VOUT |
VLOGIC | VOUT |
GND | GND |
SDA | p9 |
SCL | p10 |
API¶
Import library
Public Member Functions |
|
ITG3200 (PinName sda, PinName scl) | |
Constructor.
|
|
char | getWhoAmI (void) |
Get the identity of the device.
|
|
void | setWhoAmI (char address) |
Set the address of the device.
|
|
char | getSampleRateDivider (void) |
Get the sample rate divider.
|
|
void | setSampleRateDivider (char divider) |
Set the sample rate divider.
|
|
int | getInternalSampleRate (void) |
Get the internal sample rate.
|
|
void | setLpBandwidth (char bandwidth) |
Set the low pass filter bandwidth.
|
|
char | getInterruptConfiguration (void) |
Get the interrupt configuration.
|
|
void | setInterruptConfiguration (char config) |
Set the interrupt configuration.
|
|
bool | isPllReady (void) |
Check the ITG_RDY bit of the INT_STATUS register.
|
|
bool | isRawDataReady (void) |
Check the RAW_DATA_RDY bit of the INT_STATUS register.
|
|
float | getTemperature (void) |
Get the temperature of the device.
|
|
int | getGyroX (void) |
Get the output for the x-axis gyroscope.
|
|
int | getGyroY (void) |
Get the output for the y-axis gyroscope.
|
|
int | getGyroZ (void) |
Get the output on the z-axis gyroscope.
|
|
char | getPowerManagement (void) |
Get the power management configuration.
|
|
void | setPowerManagement (char config) |
Set power management configuration.
|
Library¶
Import libraryITG3200
ITG-3200 triple axis, digital gyroscope library.