← Back to Autumn 2025 Overview

Week 2 — Events & Inputs (Digital Dice Roller)

Focus Concept: Event-driven programming (inputs trigger actions)
Mini-Project: Dice Roller


Objectives

  • Explore how events (button press, shake) trigger code.
  • Use inputs (buttons, accelerometer) to control outputs on the micro:bit.
  • Create a dice roller that generates a random number.
  • Extend the project with extra events and outputs (Button B, Shake, dot patterns).

Success Criteria

  • I can explain what an event is and give an example.
  • I can use pick random to generate a number and display it.
  • I can add a second input (Button B or Shake) to trigger a different behaviour.

Key Vocabulary & Definitions

  • Input — something the micro:bit senses (e.g., button press, shake, light).
  • Output — how the micro:bit responds (e.g., LEDs, sound, text).
  • Event — an action that makes the micro:bit run a block of code (e.g., “on button A pressed”).
  • Accelerometer — a sensor that measures movement or tilt (used for “shake”).
  • Random — an unpredictable number chosen by the computer, like rolling dice.
  • Conditional — code that makes a decision (e.g., “if light < 50, show moon, else show sun”).
  • Logic — the set of rules a computer follows to decide what to do. In coding we use conditionals (logic blocks like if…then…else) to check conditions and choose between actions. Logic can also use connectors such as AND, OR, and NOT to combine conditions.

Resources


Equipment

  • BBC micro:bits + USB cables (1 per child or pair).
  • Chromebooks with internet access.
  • Projector for demo.
  • Optional: speakers/buzzer for dice “roll” sound.

Safety & Setup Notes

  • Remind participants not to throw micro:bits when testing “shake”.
  • Handle cables gently — use data cables not charging-only ones.
  • Work in pairs to share devices and debugging tips.

← Back to Autumn 2025 Overview