Try This: Get Familiar Z-Axis Angle Measurements
The previous page Did You Know? This Way Up explained how to use arccos to calculate the angle between the micro:bit’s z sensing axis and gravity.
When the LED display is facing straight down, so is the z-sensing axis. So the angle between z and gravity is zero.
As the angle between the z-axis and gravity increases, so does the measurement. When the LED display (and z-axis) is facing straight up, it’s angle is 180°. Again, rotating past 180°, the angle decreases, like the last example where it’s back down to 135° again.

Example project: z_axis_degree_of_tilt_try_this
- Enter z_axis_degree_of_tilt_try_this.
- Flash it into the micro:bit.


- Open the terminal and experiment with various levels of tilt and rotation.

- Fill in the table with your measured z_angle values.
| z | z_angle |
Direction LEDs are facing |
| 1024 | 0 | Straight down |
| 728 | 45 | Halfway between straight down and sideways |
| Sideways | ||
| -728 | 135 | Halfway between sideways and straight up |
| -1024 | 180 | Straight up |
| Halfway past straight up on way to sideways | ||
| Tilted toward you by 45° | ||
| Tilted away from you by 45° | ||
| GND corner tilted down by 45° | ||
| 0 corner tilted down by 45° |