MPU6050 library test

Dependencies:   mbed MPU6050_testAAAAAAAAAAAAA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MPU6050.h"
00003 
00004 MPU6050 mpu1(p9,p10,0x68);
00005 //MPU6050 mpu2(p9,p10,0x69);
00006 Serial pc(USBTX,USBRX);
00007 
00008 float gx,gy,gz,ax,ay,az;
00009 
00010 int main()
00011 {
00012     pc.baud(9600);
00013 
00014     mpu1.start();
00015 //    mpu2.start();
00016     while(1) {
00017         mpu1.read(&gx,&gy,&gz,&ax,&ay,&az);
00018         pc.printf("ax,ay,az %.2f,%.2f,%.2f\r\n",ax,ay,az);
00019 //        mpu2.read(&gx,&gy,&gz,&ax,&ay,&az);
00020 //        pc.printf("     ax,ay,az %.2f,%.2f,%.2f\r\n",ax,ay,az);
00021         wait(1);
00022     }
00023 }