As you saw in Chapter 1, the micro:bit has a built-in magnetometer that serves a variety of purposes. In this chapter, we’ll use it to turn your micro:bit into a compass that tells you which direction you’re facing. We’ll also measure the magnetic fields of neodymium magnets. Then, we’ll make a magnetic alarm that rings whenever someone opens the door.
In this project, shown in Figure 4-1, you’ll use the micro:bit’s built-in magnetometer as a compass. It will display an arrow on the screen that ...