View on GitHub

code-club-2025-6

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

Lesson 3: Variables (Teacher Notes)

This is the teacher guide for Lesson 3. It includes the lesson flow, strategies, and example code.


Learning Objectives


Suggested Lesson Flow

1. Introduction (5 mins)

2. Demonstration (5 mins)

3. Student Activity (15–20 mins)

4. Wrap-Up (5 mins)


Common Issues & Fixes

Problem Solution
Number doesn’t change Ensure the student added change count by inside the right button block.
Screen doesn’t update Add show number count after changing the variable.
Reset doesn’t work Make sure set count to 0 is inside A+B event.

Demo Code Example (JavaScript)

let count = 0
basic.showNumber(count)

input.onButtonPressed(Button.A, function () {
    count += 1
    basic.showNumber(count)
})

input.onButtonPressed(Button.B, function () {
    count += -1
    basic.showNumber(count)
})

input.onButtonPressed(Button.AB, function () {
    count = 0
    basic.showNumber(count)
})

Extension Examples

Score Keeper

let score = 0
input.onButtonPressed(Button.A, function () {
    score += 5
    basic.showNumber(score)
})
input.onButtonPressed(Button.B, function () {
    score += 1
    basic.showNumber(score)
})

Shake to Multiply

let value = 1
input.onGesture(Gesture.Shake, function () {
    value = value * 2
    basic.showNumber(value)
})

Temperature in a Variable

let temp = 0
input.onButtonPressed(Button.A, function () {
    temp = input.temperature()
    basic.showNumber(temp)
})