Seeed_Grove_Digital_Gyro

Dependencies:   ITG3200 mbed

Fork of Seeed_Grove_Digital_Gyro by Seeed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 #include "ITG3200.h"
00004 
00005 ITG3200 gyro(p9, p10, 0x68);
00006 DigitalOut myled(LED1);
00007 DigitalOut myled2(LED2);
00008 
00009 int main(void)
00010 {
00011     int x = 0, y = 0, z = 0, temp = 0;
00012     //Set highest bandwidth.
00013     gyro.setLpBandwidth(LPFBW_42HZ);
00014 
00015     while (1) {
00016         wait(0.1f);
00017         x = gyro.getGyroX();
00018         y = gyro.getGyroY();
00019         z = gyro.getGyroZ();
00020         temp = gyro.getTemperature();
00021         myled = 1;
00022         printf("Temp: %d, X: %d, Y: %d, Z: %d\n", temp, x, y, z);
00023         
00024     }
00025 
00026 }