Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MyMPU6050.h
- Revision:
- 13:0fc0f858fe0c
- Parent:
- 12:775e1464e042
--- a/MyMPU6050.h Wed Dec 09 03:25:10 2015 +0000 +++ b/MyMPU6050.h Wed Mar 18 21:53:16 2020 +0000 @@ -22,12 +22,15 @@ _pc = pc; } + float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector + + void loop() { // if programming failed, don't try to do anything if (!dmpReady) return; // _pc->printf("dmp ready\n"); - + mpuInterrupt=true; // wait for MPU interrupt or extra packet(s) available if (!mpuInterrupt && fifoCount < packetSize) { return; @@ -74,7 +77,7 @@ mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); - mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); + //mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); float newTheta; if (ypr[1]>0) newTheta = ypr[2]; else if (ypr[2]<0) newTheta = -M_PI-ypr[2]; @@ -146,7 +149,6 @@ // orientation/motion vars Quaternion q; // [w, x, y, z] quaternion container VectorFloat gravity; // [x, y, z] gravity vector - float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector int16_t gyroData[3]; volatile float theta; bool thetaInitFlag;