Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
Razor_AHRS_HAT | 2014-01-29 | ||
FREEImu | 2013-06-30 | ||
MPU6050 | 2013-06-26 | ||
README | 2013-06-26 | 848 Bytes | |
Totals: 4 Items | 848 Bytes | 2 |
Sketch for Arduino (http://arduino.cc/) Using I2C device libraries https://github.com/jrowberg/i2cdevlib/tree/master/Arduino Frame exchange protocol fixed size of 30 bytes like this : typedef struct { int16_t Begin ; // 2 Debut uint16_t Cpt ; // 2 Compteur trame or Code float gyro[3]; // 12 [Y, P, R] gyro float acc[3]; // 12 [x, y, z] Acc int16_t End ; // 2 Fin } hat; _hat hat; void setup() { Serial.begin(115200); // header frame hat.Begin=0xAAAA; // Frame Number or Error code hat.Cpt=0; // footer frame hat.End=0x5555; mpu.init(); } void loop() { mpu.dmpGetYawPitchRoll(hahattire.gyro); mpu.dmpAccXYZ(hat.acc); // Send HAT Trame to PC Serial.write((byte*)&hat,30); hat.Cpt++; if (hat.Cpt>999) { hat.Cpt=0; } delay(1); }