For test MPU6050

Dependencies:   mbed

main.cpp

Committer:
Shikaneo
Date:
2014-07-08
Revision:
0:897889ddd75a
Child:
1:30c935175814

File content as of revision 0:897889ddd75a:

#include "mbed.h"
#include "MPU6050.h"

Serial pc(USBTX,USBRX);
I2C i2c(p28,p27);

int main() {
    pc.printf("HelloWorld!!\n\r");
    MPU6050 dev(&i2c);
    i2c.frequency(400000);
    float accl[3];
    float gyro[3];
    while(1) {
        dev.getAccelero(&accl[0]);
        dev.getGyro(&gyro[0]);
        pc.printf("\n\rAccl:");
        for(int i=0;i<3;i++)
            pc.printf("%+08.4f  ",accl[i]);
        pc.printf("      Gyro:");
        for(int i=0;i<3;i++)
            pc.printf("%+08.4f  ",gyro[i]);
        
//        pc.printf("connected:%d\n\r", dev.testConnection()?1:0);
        
    }
}