Keegan Hu
/
MPU6050_Driver_Balance
fsaf
Fork of MPU6050_Driver_Balanceddddd by
Diff: main.cpp
- Revision:
- 0:badebd32bd8b
- Child:
- 1:f9658c7309ef
diff -r 000000000000 -r badebd32bd8b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 09 14:34:45 2018 +0000 @@ -0,0 +1,25 @@ +#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); + } + } +}