New
New
Year 5

Controlling with conditions

I can write a program which contains a conditional loop.

New
New
Year 5

Controlling with conditions

I can write a program which contains a conditional loop.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Conditions are either True or False.
  2. A conditional loop repeats a chunk of code until a condition is met.
  3. Microcontrollers can be programmed to respond to inputs.

Keywords

  • Condition - a condition is a statement that can be either True or False

  • Conditional loop - a chunk of code that repeatedly runs a section of the program until a condition is met

Common misconception

A condition can have multiple possible answers.

A condition must always be either True or False in a program.


To help you plan your year 5 computing lesson on: Controlling with conditions, download all teaching resources for free and adapt to suit your pupils' needs...

In addition to knowing how to connect Sparkles to Crumble controllers and write programs, you will need to know how to connect a push button switch.
Teacher tip

Equipment

Crumble controller, Sparkle LED, battery pack, crocodile clips, push button switch

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is an algorithm?
a type of electrical motor
a component of a microcontroller
a random set of instructions
Correct answer: a precise sequence of instructions to complete a task
Q2.
What is an infinite loop?
Correct answer: a sequence of instructions that repeats forever
a loop that runs exactly 10 times
a machine that generates electricity
a tool used to draw algorithms
Q3.
What does a count-controlled loop do?
runs forever without stopping
Correct answer: repeats a section of a program a specific number of times
stores data in a microcontroller
converts energy into motion
Q4.
What is the name of the Crumble output component that emits light and can shine in different colours?
Correct Answer: Sparkle, sparkle
Q5.
Arrange the steps for connecting components to a microcontroller:
1 - select the components you want to connect
2 - connect the components to the correct pads on the microcontroller
3 - write the program to control the components
4 - test the setup to ensure everything works
Q6.
What is an example of an output component?
Correct answer: a motor
a loop
an algorithm
a sequence

6 Questions

Q1.
Match the terms to their definitions:
Correct Answer:condition,a statement that can be either True or False

a statement that can be either True or False

Correct Answer:conditional loop,code that repeatedly runs until a condition is met

code that repeatedly runs until a condition is met

Correct Answer:microcontroller,a small computer that can respond to inputs and execute code

a small computer that can respond to inputs and execute code

Correct Answer:input,a signal or data received by the microcontroller

a signal or data received by the microcontroller

Q2.
Arrange the steps for programming a microcontroller to respond to inputs:
1 - connect the input device to the microcontroller
2 - write the code to handle the input
3 - upload the program to the microcontroller
4 - test the program by using the input device
Q3.
What is a condition in programming?
a type of loop
a block of code that never runs
Correct answer: a statement that can be either True or False
a microcontroller component
Q4.
What does a conditional loop do?
runs a program forever
Correct answer: repeats a chunk of code until a condition is met
converts electrical energy to mechanical energy
stores data in a microcontroller
Q5.
Which of these is using a condition controlled loop?
Correct answer: do until button pressed
repeat 10 times
wait 0.5 seconds
set Sparkle to red
Q6.
What does True mean in a condition?
the loop runs indefinitely
the program stops
the condition is not met
Correct answer: the condition is met