printf("a/g: %.2f g %.2f g %.2f g %.2f d/s %.2f d/s %.2f d/s
\n",(float)ax/16384,(float)ay/16384,(float)az/16384,
(float)gx/131,(float)gy/131,(float)gz/131);
}
This is a class library used to operate MPU6050, which can directly read and set MPU6050. Here are some
member functions:
MP U6050()/MPU6050(uint8_t address):
Constructor. The parameter is I2C address, and the default I2C address is 0x68.
vo id initialize();
Initialization function, used to wake up MPU6050. Range of accelerometer is ±2g and range of gyroscope
is ±250 degrees/sec.
vo id getMotion6(int16_t* ax, i nt16_t* ay, int16_t* az, i nt16_t* gx, i nt16_t* gy, int16_t* gz);
Get the original data of accelerometer and gyroscope.
in t16_t g etTemperature();
Get the original temperature data of MPU6050.
For details about more relevant member functions, pleases refer to MPU6050.h or visit:
https://github.com/jrowberg/i2cdevlib