Please read and follow the directions in the "How to use this forum" post.
Post the code, using code tags.
I used a euler formula to calcuate the angle of the accelerometer.
What formula, exactly? Post a link to the theory.
You may find this page useful. How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot