Where am I? – Compass


Shuri groused. “This is a bit silly isn’t it? Why would we need a compass?”

“To tell you which direction you’re facing?” offered Ryo.
“We already have a natural compass. It’s called the SUN.” glowered Shuri.

Ryo nodded in agreement.

“Can’t argue with that. But there’s a fundamental flaw in that design.”
“Remember when Dai and Hendrah made that sundial?”
“Er yeah. The one everyone called Daylight?”
“Right. And remember why everyone called it that?”
“Of course, that’s because it only works in daytime, when it’s light. But I don’t see what that has to do with using the sun to tell direction. After all, the sun is always there. All we need to do is see where it is in the sky as it rises and se.. er.. sets…” .. Shuri’s eyes opened wide in realization. “Er… oookay. Let’s get coding shall we?”

Additional Challenge

Try programming your compass to be sensitive to directional headings such as NE, NW, SE and SW.

Learning Points

  • Use of in-built magnetometer
  • Use of variables
  • Use of logic statements
  • Display on Micro:bit LED Array

Block Editor Code

Click the button below to download the block editor code for this challenge. The hex file is contained in a zip folder.

Kindly refer here for instructions on importing code into Micro:bit. 

This code can be imported into the micro:bit block editor.

Keep in Touch

We would love to keep in touch with you and as a result aid you along your digital making journey.

Becoming a digital maker subscriber means you will receive exclusive offers and we will keep you up to date with new resources and kits, as well as upcoming events and workshops.

Let us know how your digital maker journey is progressing. Send us pictures and videos of your awesome creations and use the hashtag below.