fsaf

Dependencies:   mbed

Fork of MPU6050_Driver_Balanceddddd by Keegan Hu

main.cpp

Committer:
heroistired
Date:
2018-04-09
Revision:
0:badebd32bd8b
Child:
1:f9658c7309ef

File content as of revision 0:badebd32bd8b:

#include "mbed.h"
#include "mpu6050.h" 


DigitalOut myled(LED1);
Serial pc(SERIAL_TX, SERIAL_RX);

int main() {
    float pitch,roll,yaw;       //欧拉角

    MPU_Init();                 //初始化MPU6050
    myled = 0;
    while(mpu_dmp_init())
    {
        wait(0.2);
        myled = !myled;
    }    
    while(1)
    {
        if(mpu_dmp_get_data(&pitch,&roll,&yaw)==0)//获取欧拉角
        { 
            pc.printf("pitch: %.2f roll: %.2f yaw: %.2f\r\n", pitch,roll,yaw);
        }
    }   
}