STM32
直播中

李辉

7年用户 1301经验值
私信 关注
[问答]

请问有什么方法去控制一种mpu9250九轴传感器吗

请问有什么方法去控制一种mpu9250九轴传感器吗?

回帖(1)

刘桂珍

2021-12-15 14:15:23
MPU9250:

1.hardware
mpu mpu9250
同时新增加一个DMP文件夹
2.hallib

3.设置


















记得要define,同时屏蔽部分代码,不然报错。同时上位机的波特率要设置好,同时关掉数据校验。
4.main
#include "mpu.h"
#include "mpu9250.h"
#include "inv_mpu.h"
#include "inv_mpu_dmp_motion_driver.h"
u8 t1=0,report=1;               //默认开启上报
    u8 key1;
    float pitch,roll,yaw;           //欧拉角
    short aacx,aacy,aacz;           //加速度传感器原始数据
    short gyrox,gyroy,gyroz;        //陀螺仪原始数据
    short temp1;                    //温度
MPU9250_Init();                 //初始化MPU9250
其余的直接复制就行
5.效果


举报

更多回帖

发帖
×
20
完善资料,
赚取积分