Seeed / Mbed 2 deprecated Seeed_Grove_Digital_Gyro

Dependencies:   ITG3200 mbed

Fork of ITG3200_HelloWorld by Aaron Berk

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(D14, D15, 0x68);
00006 
00007 int main(void)
00008 {
00009     int x = 0, y = 0, z = 0, temp = 0;
00010     //Set highest bandwidth.
00011     gyro.setLpBandwidth(LPFBW_42HZ);
00012 
00013     while (1) {
00014         wait(0.1f);
00015         x = gyro.getGyroX();
00016         y = gyro.getGyroY();
00017         z = gyro.getGyroZ();
00018         temp = gyro.getTemperature();
00019         printf("Temp: %d, X: %d, Y: %d, Z: %d\n", temp, x, y, z);
00020     }
00021 
00022 }