Test Tilts

Let's test tilts: level, left, right, toward, and away from you.

When you vary the tilt angle from left to right, the x-axis accelerometer measurement values vary accordingly.

When you vary the tilt angle from facing toward you to facing away from you, the y-axis accelerometer measurement values also vary accordingly.

Example script: test_tilts_intro

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

from microbit import *


while True:
    x = accelerometer.get_x()
    y = accelerometer.get_y()
    print("x =", x, ", y =", y)
  • Open the terminal.
  • Take measurements as shown in the animation, recording the x and y values for each tilt angle in the table below the animation.


Direction Angle     X       Y   
Vertical facing away 90° 0 1024
Mostly facing away 60°    
Slightly facing away 30° 0 512
Slightly facing towards you -30°    
Mostly facing towards you -60°    
Vertical facing towards you -90°    
Vertical facing left 90°    
Mostly tilted left 60° 888 0
Slightly tilted left 30°    
Slightly tilted right -30°    
Mostly tilted right -60°    
Vertical facing right -90°