The gyro gives us the rate of change of the angle. With integration we can find the angle however this will be accurate only in the short term.
Use the accelerometer x y z axes readings to determine the angle between x-z and y-z axes. This quantity will give absolute orientation.
Ensure the angle is noise free with no impulsive spikes.
Optional
Look into sensor fusion techniques like complementary filter to get a more accurate reading
The gyro gives us the rate of change of the angle. With integration we can find the angle however this will be accurate only in the short term.
Use the accelerometer x y z axes readings to determine the angle between x-z and y-z axes. This quantity will give absolute orientation.
Ensure the angle is noise free with no impulsive spikes.
Optional
Look into sensor fusion techniques like complementary filter to get a more accurate reading