tanakamasayuki / I2C_MPU6886

Library to control I2C MPU6886
Creative Commons Zero v1.0 Universal
12 stars 4 forks source link

I2C MPU6886 IMU Library

This is a library of MPU6886, the IMU for I2C connectivity.

Support Devices

Usage

#include "I2C_MPU6886.h"

I2C_MPU6886 imu(I2C_MPU6886_DEFAULT_ADDRESS, Wire1);

void setup() {
  Serial.begin(115200);
  delay(1000);

  Wire1.begin(21, 22);

  imu.begin();
  Serial.printf("WhoAmI() = 0x%02x\n", imu.WhoAmI());
}

void loop() {
  float ax;
  float ay;
  float az;
  float gx;
  float gy;
  float gz;
  float t;

  imu.getAccel(&ax, &ay, &az);
  imu.getGyro(&gx, &gy, &gz);
  imu.getTemp(&t);

  Serial.printf("%f,%f,%f,%f,%f,%f,%f\n", ax, ay, az, gx, gy, gz, t);

  delay(100);
}