Use code to explore the accelerometer sensor on the micro:bit.
Create a new blank JavaScript Blocks project.
The micro:bit can tell if you move, tilt or shake it. It does this using an accelerometer. The accelerometer measures the acceleration of the micro:bit (how fast it speeds up or slows down).
Acceleration is measured using milli-g, which is 1/1000 of a g.
A g is as much acceleration as you get from Earth’s gravity.
Try this example code that shows the acceleration of the micro:bit with a bar graph.
To test it out, run it on the micro:bit.
Can you make the value change?
Try changing the variable from x to y.
What is the difference?
What about z?