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

# test_tilts_intro

from microbit import *

sleep(1000)

while True:
    x = accelerometer.get_x()
    y = accelerometer.get_y()
    
    print("x =", x, ", y =", y)
    
    sleep(750)

IMPORTANT: In the animation below, just focus on how the micro:bit is tilted.  The application does not transmit tilts to the cyber:bot.  That will come later. 

  • Click Show serial to open the serial monitor.
    (See Use the Serial Monitor.)
  • 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
Level    
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°    
Level    
Slightly tilted right -30°    
Mostly tilted right -60°    
Vertical facing right -90°