EasyManua.ls Logo

Freenove Ultimate Starter Kit

Freenove Ultimate Starter Kit
286 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 25 Attitude Sensor MPU6050
266
www.freenove.com
support@freenove.com
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);
}
Finally, the main functions, call setup function and loop function respectively.
int main()
{
setup();
w hile(1){
loop();
}
r eturn 0;
}
About class MPU6050
Class MPU6050
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

Table of Contents