Example for ITG3200 gyro

Dependencies:   ITG3200 mbed

Fork of ITG3200_HelloWorld by Aaron Berk

main.cpp

Committer:
sam_grove
Date:
2014-08-15
Revision:
2:e2676f02a6b1
Parent:
1:6a040ee9e40b

File content as of revision 2:e2676f02a6b1:


#include "mbed.h"
#include "ITG3200.h"

ITG3200 gyro(D14, D15, 0x68);

int main(void)
{
    int x = 0, y = 0, z = 0, temp = 0;
    //Set highest bandwidth.
    gyro.setLpBandwidth(LPFBW_42HZ);

    while (1) {
        wait(0.1f);
        x = gyro.getGyroX();
        y = gyro.getGyroY();
        z = gyro.getGyroZ();
        temp = gyro.getTemperature();
        printf("Temp: %d, X: %d, Y: %d, Z: %d\n", temp, x, y, z);
    }

}