How it Works: Z-axis
The accelerometer’s z-sensing axis aligns with gravity when the micro:bit is held level with its LED display facing down. In that position, acceleration (z) returns a measurement in the -1024 neighborhood.
Held vertically, it returns zero since the z-axis is perpendicular to gravity— it doesn’t line up at all. If held vertically, rotation angle won’t matter to the z-axis, it still returns zero. Held with the LED display facing up, the z-axis is aligned with gravity again but pointing in the opposite direction. Because of that, the acceleration (z) block returns a value near -1024.
As for how the project test-z-axis-tilt works, it is basically the z-axis version of test_tilt_intro. The main difference is that:
…has been replaced with