The gyro reports the rate of rotation about each axis, not the angle.
There are two ways to get angles: (1) use the accelerometer with code to estimate static tilt angles or (2) use all the sensors with AHRS (Attitude and Heading Reference System) code to estimate 3D orientation.
(1) use the accelerometer with code to estimate static tilt angles or (2) use all the sensors with AHRS (Attitude and Heading Reference System) code to estimate 3D orientation.
Previous reply gave me a link to another MPU (6250). I dont have that.
You can use the attached programs (one is a compass, the other an AHRS), but they won't work properly if you do not carefully calibrate both the accelerometer and the magnetometer.
Follow the instructions in this tutorial to perform the calibration (also described within the code).
The program package includes a short program to collect data for the calibration. I use an Excel spreadsheet to convert data formats between programs.