✦ ✦
Future-Ready · Robotics

How a robot follows a program

A robot uses instructions from its program. These can include a sequence of steps, loops that repeat, and IF/THEN decisions.
🧩A sequence with a repeated movement
📋 The Program 1 · Move forward ▲ 2 · Turn right ↻ 🔁 REPEAT × 4 { Move forward ▲ } end repeat Run top → bottom, in order. RUN start 🎯 🤖 Route to the flag
The robot reads the blocks one after another. The loop repeats one move four times to reach the 🎯 goal.
📋 Sequence
Steps in order, as shown from top to bottom. Changing the order can change the route.
🔁 Loop
A repeat block. Instead of writing "move" 4 times, you write it once and say ×4.
🔀 IF / THEN
A choice. The program carries out a step if its condition is true.
🔀Checking a bump sensor
🚗 Driving… IF bump sensor pressed? YES THEN turn right ↻ NO ELSE keep going ▲ 🔁 check again… 🧱 a wall!
IF asks whether a condition is true. Here the program checks the bump sensor.
THEN gives the instruction for YES (true).
ELSE gives the instruction for NO (false).
It checks again and again, so it can detect the bump on a later check and respond.
🏠A robot vacuum’s rules
🛋️ couch 💥 🤖 vacuum IF bumped → turn ELSE → keep cleaning
Three instructions in an example vacuum
📋Sequence: drive straight, vacuuming as it goes.
🔁Loop: repeat the cleaning pattern until the program meets its stopping condition.
🔀IF/THEN: if the bump sensor hits the couch, then turn. Otherwise, keep moving forward.
🔑Key Terms
🗺️Algorithm An ordered plan for solving a problem or completing a task.
📋Sequence Steps carried out in a set order, one after another, from first to last.
🔁Loop A structure that repeats steps a set number of times or while a condition holds.
🔀Conditional (IF/THEN) A structure that runs one or more steps if a condition is true. An optional ELSE gives another action if the condition is false.
💾Program The instructions a computer executes, which can include sequences, loops and conditions.
🐞Debugging Finding and fixing the mistakes ("bugs") in a program so the robot behaves the way you want.
Trace the move, turn and four repeated moves. If the robot turned before its first move, would it follow the same route? ✏️ ClickClass · Programming a robot with loops and conditions
✏️ Future-Ready Anchor Chart · Programming a Robot: Sequences, Loops & IF/THEN
ClickClass offers hundreds of free printables at clickclassedu.com/printables.