View on GitHub

code-club-2025-6

2025/6 Code Club resources/lessons for BBC Micro:Bit and Cutebot

Lesson 5: Conditionals (Teacher Notes)

This is the teacher guide for Lesson 5.
It includes lesson flow, strategies, and example logic using if / else statements.


Learning Objectives


Suggested Lesson Flow

1. Introduction (5 mins)

Examples:


2. Demonstration (5–7 mins)

On the board or projector, demonstrate:

acceleration (strength) > 800

Inside the condition:

Explain:


3. Student Activity (15–20 mins)

Students must:

  1. Add on shake block
  2. Put an if / else inside
  3. Use this condition:
acceleration (strength) > 800
  1. Add icons:
    • IF → Sad face
    • ELSE → Happy face

Then add a second conditional:

Encourage students to test:


4. Extension / Fast Finishers

Challenge students to:

if speed > 800 AND button B is pressed

Optional real-world links:


Common Issues & Fixes

Problem Fix
Icons don’t change Make sure the if / else is inside on shake or on button A
Always shows same icon Student may have used < instead of > or wrong number
Nothing happens Check they used acceleration (strength) not direction
Too sensitive / not sensitive Adjust number to 400 / 1200

Example Code (JavaScript)

input.onGesture(Gesture.Shake, function () {
    if (input.acceleration(Dimension.Strength) > 800) {
        basic.showIcon(IconNames.Sad)
    } else {
        basic.showIcon(IconNames.Happy)
    }
})

input.onButtonPressed(Button.A, function () {
    if (input.acceleration(Dimension.Strength) > 800) {
        basic.showString("FAST")
    } else {
        basic.showString("SLOW")
    }
})

Reflection (Teacher Prompts)