Skip to main content

Case 06: Compass

Purpose

Use the Smart Coding Kit to create a wearable compass.

1 x ELECFREAKS micro:bit Smart Coding Watch Kit

Software

MakeCodemakecode

Programming

Save the returned value of the compass direction as varible i and judge it, if i<45 or i>315, display “N”; if i<135, display “E”; if i<225, display “S”, or display “W”.

Link:https://makecode.microbit.org/_9j6J7YTtyaVL

You can also download it direcly below:

Result

The current direction displays on the micro:bit.

Exploration

FAQ

Relevant File