Skip to content


Graphical dice

Beginner | MakeCode, Python | Accelerometer, LED display | Number & place value, Probability, Randomisation, Representation, Selection

Step 1: Make it

What is it?

A dice project that looks like a real die with patterns of dots instead of numbers.

micro:bit being shaken showing 5 dots on its LED display

How it works

  • Like the Dice project this uses the accelerometer input to trigger the creation of a random number between 1 and 6 and show it on the LED display output when you shake the micro:bit.
  • Instead of showing a number, this program uses selection to show dots on the display to represent the numbers, looking like the dots on each face of real dice, depending on which random number was generated.

What you need

  • micro:bit (or MakeCode simulator)
  • MakeCode or Python editor
  • battery pack (optional)
  • squared paper for designing your own dice faces (optional)

Step 2: Code it

Step 3: Improve it

  • Make the display clear after a few seconds to make the batteries last longer and to make it clear when you have rolled two numbers the same.
  • Draw your own dot patterns to represent each number.
  • Make it roll higher numbers. How would you represent them on the 5x5 LED grid display output?