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.
Dependents: sgam-lib sgam_mdw_NUCLEOF429ZI_impl
Fork of MPU6050 by
Usage
#include "mbed.h"
#include "MPU6050.h"
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
I2C i2c(I2C_SDA, I2C_SCL);
MPU6050 mpu(i2c);
int16_t ax, ay, az;
int16_t gx, gy, gz;
int main()
{
pc.printf("MPU6050 test\n\n");
pc.printf("MPU6050 initialize \n");
mpu.initialize();
pc.printf("MPU6050 testConnection \n");
bool mpu6050TestResult = mpu.testConnection();
if(mpu6050TestResult) {
pc.printf("MPU6050 test passed \n");
} else {
pc.printf("MPU6050 test failed \n");
}
while(1) {
wait(1);
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
//writing current accelerometer and gyro position
pc.printf("%d;%d;%d;%d;%d;%d\n",ax,ay,az,gx,gy,gz);
}
}
Revision 1:1e0baaf91e96, committed 2013-05-08
- Comitter:
- garfieldsg
- Date:
- Wed May 08 00:34:55 2013 +0000
- Parent:
- 0:662207e34fba
- Child:
- 2:8c562a8fed36
- Commit message:
- Bugfix of memory issu
Changed in this revision
| I2Cdev.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MPU6050.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/I2Cdev.cpp Fri Jan 11 00:54:28 2013 +0000
+++ b/I2Cdev.cpp Wed May 08 00:34:55 2013 +0000
@@ -137,6 +137,7 @@
for(int i =0; i < length; i++) {
data[i] = redData[i];
}
+ free (redData);
return length;
}
--- a/MPU6050.h Fri Jan 11 00:54:28 2013 +0000
+++ b/MPU6050.h Wed May 08 00:34:55 2013 +0000
@@ -848,7 +848,7 @@
uint8_t dmpGetGyroSensor(int16_t *data, const uint8_t* packet=0);
uint8_t dmpGetGyroSensor(VectorInt16 *v, const uint8_t* packet=0);
uint8_t dmpGetControlData(int32_t *data, const uint8_t* packet=0);
- uint8_t dmpGetTemperature(int32_t *data, const uint8_t* packet=0);
+ uint8_t dm pGetTemperature(int32_t *data, const uint8_t* packet=0);
uint8_t dmpGetGravity(int32_t *data, const uint8_t* packet=0);
uint8_t dmpGetGravity(int16_t *data, const uint8_t* packet=0);
uint8_t dmpGetGravity(VectorInt16 *v, const uint8_t* packet=0);
