numbers get bigger (1, 2, 3 and so on). Move to the bottom, to the
left, or down to the floor, and the numbers get smaller. They are
negative numbers (-1, -2, -3, and so on) because they are less than
zero.
For this project, you will be using readings along the x-axis in
micro-gravities (mg). To show different amounts of tilt, the micro:bit
translates those readings into numbers between -1023 (tilted all the
way left) and 1023 (tilted all the way right). Zero is level (laying flat).
You will have to take the micro:bit’s number and translate it again,
to degrees between 0 and 180 that the servo will understand. (See
the “Servo Basics” box on page 162 for how that works.)
Why 1023 and -1023? Computers are basically a big collection of
switches, which can be either on or off. To do their calculations, they
use only two digits: 0 and 1. (That’s called the binary system.) The
micro:bit is a tiny computer that has a limited amount of memory,
so the designers assigned 210 (two multiplied by itself 10 times)
for the accelerometer. That equals 1024, but since computers start
counting at zero instead of one, you have to subtract one from 1024.
The answer is 1023!