Hi im using the altimu-10 v4 sensor to display pitch and roll on the serial monitor. I obtained an example code which reads the accelerometer and magnetometer giving raw values. I only need the accelerometer data but i am unable to understand where i should apply the mathematical formula to convert acceleration to pitch and roll and display it. Any idea guys?

Ill attach my codes.

Roll angle= [atan2(y_acceleration, sqrt(sq(x_acceleration) + sq(z_acceleration)))] * (360/2pi)

Pitch angle= [atan2(x_acceleration, sqrt(sq(y_acceleration) + sq(z_acceleration)))] * (360/2pi)

Serial.Accelerometer.ino (1.92 KB)