3 axis gyroscope & 3 axis accelerometer

Dependents:   sgam-lib sgam_mdw_NUCLEOF429ZI_impl

Fork of MPU6050 by Yihui Xiong

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);
    }
}

History

update default tip

2014-09-12, by Yihui Xiong [Fri, 12 Sep 2014 09:28:14 +0800] rev 2

update


Bugfix of memory issu

2013-05-08, by garfieldsg [Wed, 08 May 2013 00:34:55 +0000] rev 1

Bugfix of memory issu


first beta release

2013-01-11, by garfieldsg [Fri, 11 Jan 2013 00:54:28 +0000] rev 0

first beta release