笔记
作者:互联网
1. MPU数据获取
MPU6050 mpu;
mpu.testConnection();//测试MPU是否连接成功
mpu.initialize();
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); //获取加速度和陀螺仪数据 mpu.getAcceleration(&ax, &ay, &az); //获取加速度数据 mpu.getRotation(&gx, &gy, &gz); //获取陀螺仪数据
2. mpu的DMP初始化
MPU6050 mpu;
mpu.testConnection();//测试MPU是否连接成功
mpu.initialize();
devStatus = mpu.dmpInitialize();
mpu.setXGyroOffset(220);
mpu.setYGyroOffset(76);
mpu.setZGyroOffset(-85);
mpu.setZAccelOffset(1788);
if (devStatus == 0) {
mpu.setDMPEnabled(true);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), dmpDataReady, RISING);
mpuIntStatus = mpu.getIntStatus();
dmpReady = true;
packetSize = mpu.dmpGetFIFOPacketSize();
}
标签:devStatus,gz,笔记,获取,mpu,gy,MPU 来源: https://www.cnblogs.com/liuweiweitju/p/16555349.html