Parent & teacher guide
Week 5: Making Robots React
Session length: 70-85 minutes
Learning purpose
This is the big programming week. Students take the sensors from Week 4 and the sequences from Week 3 and combine them with loops and conditions so a robot can react on its own. They learn that a loop repeats steps, a forever loop repeats until it is stopped, and a repeat-until loop runs until a condition becomes true. They meet conditions and boolean (true/false) decisions, then use if and if/else to choose actions. They program obstacle avoidance - loop, read the distance sensor, and if something is close, turn - and explore line following by checking a light or color sensor to steer and stay on a line.
Expected student outcomes
By the end of this week, students can:
- Explain how a loop, a forever loop, and a repeat-until loop each repeat steps
- Describe a condition as a check that is either true or false (boolean)
- Use if to run steps only when a condition is true, and if/else to choose between two actions
- Program obstacle avoidance by looping, reading a distance sensor, and turning when something is close
- Explain how line following keeps checking a light or color sensor to steer and stay on a line
Suggested pacing
About 70-85 minutes. Adjust to your group - these are guides, not limits.
| Step | Focus | Minutes |
|---|---|---|
| Loops and conditions | Loops, forever loops, repeat-until, conditions, boolean, if, and if/else. | 18 min |
| Obstacle-avoidance program | Loop, read the distance sensor, and if/else to turn when close. | 20 min |
| Predict the wall reaction | Predict what the robot does when it meets a wall, then check. | 6 min |
| Reaction reliability test | Run three tries and record whether the robot avoided the obstacle. | 8 min |
| Line-following explore | Use a light/color sensor with repeat-until and if to stay on a line. | 18 min |
| Knowledge check | Five questions on loops, conditions, and reacting. | 8 min |
| Reflection | Write about if vs if/else and why reacting needs a loop. | 7 min |
Before you start
Set up
- Print the planning sheet, if/else decision cards, and reaction test record for each student or pair.
- For kits, charge them, attach a distance sensor and a light or color sensor, and set up a small obstacle course and a taped line.
- For the simulator, open the obstacle-course and line-follow missions on each device.
Prepare ahead
- Program the obstacle-avoidance pattern yourself first so you know a working closeness value for your sensor.
- Check the light/color sensor's on-line and off-line readings on your actual tape and floor.
- Cut out the unplugged forever, if, and if/else cards ahead of time.
Materials
- Block program planning sheet (printable)(Kit, Simulator, Unplugged)
- If/else decision-card set (printable)(Kit, Simulator, Unplugged)
- Reaction test record (printable)(Kit, Simulator, Unplugged)
- A programmable robot kit with a distance sensor and a light or color sensor(Kit)
- Boxes or books to build a small obstacle course(Kit)
- Dark tape (or a printed line) on a light floor for line following(Kit)
- Computer or tablet with the browser simulator(Simulator)
- Program cards (forever, if, if/else, move, turn, read-sensor, stop) and a floor grid or taped line(Unplugged)
- A partner to act as the robot and follow the cards(Unplugged)
Safety
- cautionKeep fingers, hair, and loose clothing away from moving wheels while a reacting robot drives, since it changes direction on its own.(Kit)
- cautionTape lines and obstacle-course pieces down flat and clear the floor so no one trips during runs.(Kit, Unplugged)
- infoSave your block program often so a browser refresh doesn't lose your work.(Simulator)
Full safety briefing
Review these once with your group. They apply across the whole course; the notes above are what matters most this week.
Batteries and circuitsKit
- Use only appropriate low-voltage educational equipment - no wall outlets and no household batteries wired by hand.
- Never connect a battery's two terminals directly to each other.
- Stop right away if a motor, wire, or battery becomes hot, and tell an adult.
- Disconnect the power before changing wheels, motors, or other mechanical parts.
Motors and gearsKit
- Keep fingers, hair, jewelry, sleeves, and loose clothing away from moving gears and wheels.
- Do not force a stalled motor that has stopped turning - switch it off and find out why.
- Make sure moving parts are secured before you run a test.
Moving robots
- Test on the floor, not on a table where the robot could drive off an edge.
- Keep robots away from stairs, roads, water, pets, and people's feet.
- Use a clear, open test area.
- Always include a safe-stop behavior so the robot halts when the job is done or something is in the way.
Tools and materialsKit, Unplugged
- Ask an adult for help with cutting or any sharp tools.
- Use safe classroom materials - no sharp, toxic, or breakable items.
- Never launch or swing an attachment toward a person.
Running the session
- 1.Teach loops, forever vs repeat-until, and conditions (true/false) before any programming, using the sense-decide-act loop from Week 1.
- 2.Build the obstacle-avoidance pattern together - forever, read sensor, if/else - then let pairs adapt it.
- 3.Do the prediction and three-try reaction test so students see reacting is about reliability, not one lucky run.
- 4.Explore line following as a keep-checking, keep-steering behavior; expect wiggling, not perfect straight lines.
- 5.End with the knowledge check and reflection.
Common misconceptions
- 'The robot only needs to check once' - without a loop it reacts a single time and then stops responding.
- 'if/else runs both branches' - it runs only the true branch or only the false branch.
- 'A bigger turn follows the line better' - large corrections overshoot; small, frequent ones work.
- Mixing up the sensor number with the condition - the sensor gives a number, the condition turns it into true/false.
Questions to ask
- Where is the loop, and what makes it stop?
- What is the condition here, and when is it true?
- What does the robot do in the 'else' - and why does it need one?
- How does the robot know it has drifted off the line?
Classroom & group adaptations
Make it easier
Give students a nearly-finished program with the if/else empty, so they only fill in 'turn' and 'drive forward'.
Make it harder
Ask students to combine both behaviors - follow a line but avoid an obstacle placed on it - using nested if/else.
Groups & whole class
In pairs or small groups, give each student a role that rotates - driver (builds or types), navigator (reads the plan), and recorder (fills the worksheet) - so everyone participates. For a whole-class demo, run one shared robot or simulator on the board, have students predict together, then let groups repeat it on their own path. Groups can also mix paths: one builds on the kit while another checks the same idea in the simulator or unplugged, then they compare results.
Hardware and no-hardware notes
Every activity this week runs three ways - all three teach the same core idea, so pick whichever fits your room. No specific product is required.
Kit
- Block program planning sheet (printable)
- If/else decision-card set (printable)
- Reaction test record (printable)
- A programmable robot kit with a distance sensor and a light or color sensor
- Boxes or books to build a small obstacle course
- Dark tape (or a printed line) on a light floor for line following
Simulator
- Block program planning sheet (printable)
- If/else decision-card set (printable)
- Reaction test record (printable)
- Computer or tablet with the browser simulator
Unplugged
- Block program planning sheet (printable)
- If/else decision-card set (printable)
- Reaction test record (printable)
- Program cards (forever, if, if/else, move, turn, read-sensor, stop) and a floor grid or taped line
- A partner to act as the robot and follow the cards
Troubleshooting
Common problems from this week's activities and what to try.
- The robot drives straight into obstaclesKitTry: Check the if is really reading the sensor, and that your closeness value is larger than the reading when a wall is right in front.
- The robot spins in place foreverKitTry: Your closeness value may be too big so it always thinks something is close; lower it, or add a short forward move in the else.
- Robot drives off the grid or into a wallSimulatorTry: Make sure the read-sensor and if/else are inside the loop, not after it, so the check happens every step.
- Robot only turns and never moves forwardSimulatorTry: Put the move-forward in the else branch so it drives whenever the path ahead is clear.
- The robot 'cheats' and just walks around obstaclesUnpluggedTry: Remind them a robot can only follow the cards; they must actually check the condition and act on it.
- The robot forgets to keep checkingUnpluggedTry: The forever card means go back to the top every time; point to it after each action.
- The robot loses the line right awayKitTry: Re-check your on-line and off-line sensor readings and set the threshold between them; the two must be clearly different.
- The robot spins in circlesKitTry: Make the correction turns small; big turns overshoot the line every time.
- The loop never endsSimulatorTry: Check the repeat-until condition (reached the end tile) can actually become true along the path.
- The robot drifts off the lineSimulatorTry: Make sure the read-sensor and if/else are inside the loop so it checks and corrects every step.
- The robot just walks the whole line smoothly without checkingUnpluggedTry: That is a human planning ahead - make them pause and re-check the condition each single step, like a loop.
- The robot argues about which way to turnUnpluggedTry: Write the rule so 'off the line' always turns toward the line, removing the guesswork.
Knowledge-check answer key
Answers are shown here for the adult only - the student worksheet keeps them hidden.
1. Decide whether this statement is true or false.
Correct answer: False
Why: False. A forever loop keeps repeating until something stops it - it does not end by itself.
2. What does a loop do in a program?
Correct answer: It repeats one or more steps instead of writing them out again and again
Why: A loop repeats steps for you, so the robot can do or check something over and over without a long program.
3. What is the difference between a forever loop and a repeat-until loop?
Correct answer: A forever loop repeats until you stop the program; a repeat-until loop repeats until a condition becomes true
Why: A forever loop only stops when you stop the program; a repeat-until loop stops itself once its condition becomes true.
4. A condition like 'is the wall close?' can only be:
Correct answer: True or false (a boolean)
Why: A condition is a check that is always either true or false - and a true/false value is called a boolean.
5. What does an if/else block do?
Correct answer: It runs one set of steps when the condition is true and a different set when it is false
Why: An if/else block chooses between two actions: the 'if' steps when the condition is true, the 'else' steps when it is false.
6. How does obstacle avoidance work?
Correct answer: A loop reads the distance sensor and, if something is close, the robot turns; else it drives forward
Why: Obstacle avoidance is a loop that reads the distance sensor and uses if/else to turn when something is close and drive forward when the path is clear.