STM32接MPU6050后串口输出

2019-07-21 02:03发布

在线求助,急急急!!
Product ID read as 0 indicates device is either incompatible or an MPU3050.
Product ID read as 0 indicates device is either incompatible or an MPU3050.

dmp初始化返回10

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
qaqgod
2019-07-21 08:24
本帖最后由 qaqgod 于 2019-5-1 17:19 编辑

不知道为什么出错,求助大神
程序用的原子哥的,主函数全局变量后输出到串口#include "sys.h"
#include "usart.h"
#include "mpu6050.h"
#include "mpuiic.h"
#include "inv_mpu.h"
#include "inv_mpu_dmp_motion_driver.h"

short ax,ay,az;        //加速度传感器原始数据
short gx,gy,gz;//陀螺仪原始数据


int main(void)
{
        uart_init(9600);
        Motor_IO_Init();                        //驱动器控制信号线初始化
        Motor_PWM_Init(7199,0);                //初始化PWM,10KHZ,用于驱动电机,驱动支持频率高达100kHz

        while(1)
       {
                temp=MPU_Get_Temperature();                        //得到温度值
                MPU_Get_Accelerometer(&ax,&ay,&az);//得到加速度传感器数据
                MPU_Get_Gyroscope(&gx,&gy,&gz); //得到陀螺仪数据
                mpu_dmp_get_data(&pitch,&roll,&yaw);//得到姿态角


                printf("ax=%d,ay=%d,az=%d ",ax,ay,az);
                printf("gx=%d,gy=%d,gz=%d ",gx,gy,gz);


               if(mpu_dmp_init())
                {
                        printf("MPU6050 Error");
                        printf("mpu_dmp_init=%d ",mpu_dmp_init());
                        delay_ms(200);
                }

       }

}

一周热门 更多>