Lesson 12

Games

The micro:bit can be used to create games. Let's create the Maths game.

Task 1

  • Program the micro:bit to create an addition game. It will display 2 random numbers.
  • The first number will be from 0 - 5 and the second number will be from 0 - 4.
  • When Button A is pressed, micro:bit will display the question.
  • The user will press Button B to find the answer.
  • Every time Button B is pressed, the number displayed is increased by 1.
  • If the number is more than 9, it will restart from 0.
  • The user will enter the answer by pressing both Button A and B.
  • If the answer is correct, right icon will be diplayed.
  • If the answer is incorrect, wrong icon and the correct answer is displayed.
  • Then, "NEXT" is displayed and the micro:bit will continue to the display the next question.

Task 2

  • Extension from the game from Task 1.
  • Shake the micro:bit to display the total Score.