As a kid, I learnt how a compass worked. It was almost magical to a 7 year old me to see a suspended bar magnet reorient itself. Now that I get to teach the kids here how to code, they often surprise me with their creations. One student came forward with such an interesting project, that I decided it just had to be documented here.

 

The Compass and radio combination

The Micro:Bit board has an inbuilt compass that can tell the direction. The MakeCode editor makes it incredibly easy to use this compass, and Asmit of class 8 decided to take this a step further by combining the compass with the radio. The Micro:Bit board has built in radio courtesy its Nordic Semiconductor nRF51822 processor. He made a system of two Micro:bit devices that can communicate with each other and send their direction to each other. So if both the people are on a hike on a mountain trail and their directions match, the radio sends a tick mark. If their directions are different, it sends a cross. The user can also press A and B buttons together to send an SOS signal. Although it is true that the range of the Micro:Bit radio is much too short to be used on an actual hike, his product is based on sound principles.

 

Here's a copy of his code

 

Here's him and his friend showing how it works and giving a demo

The code itself is relatively simple, the different directions are denoted by the amount of rotation in degrees that the Micro:Bit undergoes.