In this section, we will see the interfacing code of MPU 6050 by activating DMP, which can give us direct orientation values in quaternion or yaw, pitch, and roll. This value can be directly applied to our robotic application too.
The following section of code imports all the necessary header files to interface and create an MPU6050 object like the previous code:
#include "Wire.h" #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" //Creating MPU6050 Object MPU6050 accelgyro(0x68);
The following code initializes and declares variables to handle DMP:
//DMP options //Set true if DMP initialization was successful bool dmpReady = false; //Holds actual interrupt status byte from ...