8. Case 06: Compass

8.1. Purpose


  • Use the Smart Coding Kit to create a wearable compass.

8.2. Materials


  • 1 x smart coding kit

8.3. Software


MakeCodemakecode

8.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

8.5. Result


The current direction displays on the micro:bit.

8.6. Exploration


8.7. FAQ


8.8. Relevant File


../../_images/smart_coding_kit_case_06_01.png