BlazeX / Gyro_ITG3200
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 
00004 Serial PC(USBTX, USBRX);
00005 Serial XBee(p28, p27);
00006 I2C I2CBus(p9, p10);
00007 Timer GlobalTime;
00008 
00009 ITG3200 Gyro(I2CBus, GlobalTime);
00010 
00011 int main() 
00012 {
00013     PC.baud(115200);
00014     XBee.baud(115200);
00015     I2CBus.frequency(400000);
00016     GlobalTime.start();
00017     
00018     //Starten
00019     Gyro.Init();
00020     wait_ms(500);
00021     
00022     //0.5 Sekunden kalibrieren
00023     Gyro.Calibrate(500);
00024     
00025     while(1)
00026     {
00027         Gyro.Update();
00028         
00029         XBee.printf("%i %i %i\r\n",
00030             (int)(Gyro.Rate[0]),
00031             (int)(Gyro.Rate[1]),
00032             (int)(Gyro.Rate[2]);
00033         
00034         wait_ms(10);
00035     }
00036 }