View on GitHub

code-club-2025-6

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

Lesson 5: Conditionals (If / Else)

In this lesson, you’ll learn how to use conditionals on the Micro:bit to make your program change its behavior based on different situations. By the end, you’ll use if / else statements to react to movement (speed) and button input.


What You’ll Learn


Steps

1. Open MakeCode

Need step-by-step help? Go here

If you are happy to figure it out on your own, go to: https://makecode.microbit.org/

Click New Project and name it: Conditionals


2. Get the Speed (Acceleration)

The micro:bit has a motion sensor called an accelerometer. We can use it to measure how fast the device is moving.


3. Add an IF / ELSE Block

Now we’ll make the Micro:bit react differently depending on the speed.

Condition:

acceleration (strength) > 800

This means:


4. Show Different Icons

Inside the IF section:

Inside the ELSE section:

Test it:

✅ You just used a conditional!


5. Use a Button + Conditional

Now let’s check the speed using Button A.

Condition:

acceleration (strength) > 800

Inside IF:

Inside ELSE:

Test it:


Extra Challenges (Optional)

Try one or more:


Reflection