# Measuring Rotation Angles

### Example script: test_accel_xy_angle

• Enter this script and save it as test_accel_xy_angle.
• Flash the script into the micro:bit.
```# test_accel_xy_angle

from microbit import *
import math

sleep(1000)

while True:
x = accelerometer.get_x()
y = accelerometer.get_y()

angle = round( math.degrees( math.atan2(y, x) ) )

print("x =", x, ", y =", y, ", angle =", angle)

sleep(750)```
• Open the terminal.
• Verify that the angles reported are correct as you hold the micro:bit vertically, and rotate it to: 0°, 30°, 45°, 60°, 90°, 135° ,180°, 225°, 270°, 315°, and 360°.  Make a note of x, y, and angle for each rotation.

• Repeat the rotations, but for each vertical rotation, tilt it away from you by 45° before measuring.  As before, note the x, y, and angle values.
• Divide x into y at 45° rotation.
• Divide x into y at 45° rotation plus 45° tilt-away.

Are both results close to 1?

• Repeat  for 90° and 135°.

See how the x and y values are different for rotated vs. rotated+tilted but the y/x ratios work out to the same?