Mark Horn / Mbed 2 deprecated WITGyro

Dependencies:   Terminal mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ITG3200.h"
00003 #include "Terminal.h"
00004 
00005 Terminal term(USBTX, USBRX);
00006 ITG3200 gyro(p9, p10);
00007 
00008 int main() 
00009     {
00010     wait(1);
00011     term.printf("Starting Gyro test... \n \r");
00012     gyro.setLpBandwidth(LPFBW_42HZ);
00013     int x = 0;
00014     int y = 0;
00015     int z = 0;
00016     while (1)
00017         {
00018         wait(0.2);
00019         x = gyro.getGyroX();
00020         y = gyro.getGyroY();
00021         z = gyro.getGyroZ(); 
00022         term.printf("X-%i   Y-%i   Z-%i \n \r", x,y,z);
00023         }
00024     }