This demo uses an accelerometer to show you the acceleration in the X, Y and Z directions, in m/s2.
The positive and negative directions of X and Y are shown in the image below. Positive Z is coming up out of the LED screen. Negative Z is going into the LED screen.
These values are a new data type, called float
. Integers
represent whole numbers, but floats
represent decimal numbers.
When you move the micro:bit in the X, Y or Z direction, you should see the numbers change. They will even change a little bit when the micro:bit is sitting still, due to small vibrations. We will learn more about how to use these numbers in your code in later lessons – eventually using the accelerometer to detect tilt!
While your device is sitting still on the table, LED screen up, Z should be about -9.8
. X and Y should be between -1
and 1
.
You must be logged in to post a comment.