Home › Forums › STEM-Ready Classrooms Course Forum › Module 2 – Introduction to Coding with MakeCode Micro:bit › Reply To: Module 2 – Introduction to Coding with MakeCode Micro:bit
Tutorial completed: Dice
Using an on-screen button, the micro:bit detects when it is shaken and responds by generating and displaying a random number on the LED display, simulating the roll of a dice. The code combines a “shake” input event with a random number generator block, so each shake produces a new result between 1 and 6.
https://makecode.microbit.org/_5HgeXaMuKg3z
This tutorial could form the basis of an integrated STEM lesson linking coding, maths and design and technology. In coding, pupils explore chance, randomness and conditional logic in a hands-on way rather than on a screen alone. In maths, pupils could roll their micro:bit dice repeatedly, record and tally the results, and use this data to explore probability and create bar charts, linking data and chance from the PMC. For design and technology, pupils could invent their own dice-based games with rules they write themselves. Working in pairs would also encourage collaboration. Differentiation occurs with stronger pupils extending the code to sum two dice rolls or add sound effects.