BBC micro:bit – Magic 8 Ball

For this project we are going to code our micro:bit to act as a magic 8 ball:
magic-eight-ball

The user will think of a question such as:

  • Will it be snowing tomorrow?
  • Will I be a rock star one day?
  • Will my program work?

Then they will shake the micro-bit. The micro-bit will than randomly pick one of the following four answers:

  • No way!
  • Probably!
  • Unlikely!
  • Definitely!

Have a go at completing the task by yourself and if you get stuck or don’t know how to get started check our solution below.

Access BBC micro:bit website:
micro-bit-logo

Solution

micro-bit-magic-8-ball

Extension Task


Tweak the code to add more possible answers such as:

  • I don’t think so
  • Maybe
  • No doubt about it
  • Not sure

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 26

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: