9. Case 06: Compass

9.1. Purpose

Use the Smart Coding Kit to create a wearable compass.

9.3. Software

MakeCodemakecode

9.4. 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”.

../../_images/smart_coding_kit_case_06_02.png

9.5. Result

The current direction displays on the micro:bit.

9.6. Exploration

9.7. FAQ

9.8. Relevant File