The lesson

🧑‍🏫 Teacher Guide

The wiki's question is worth real time: "why must the value be over 2cm?" Because the HC-SR04 is only trustworthy from 2cm to 400cm — below that it returns 0, and 0 would look like "very close" and trigger the turn forever. Fix It answer: only the upper bound is tested, so a 0 reading counts as an obstacle and the car keeps turning round. If a car will not move at all, swap the batteries before you read the code — weak cells can stop a car completely. Source: ElecFreaks wiki, Case 09 "Autonomous Obstacle Avoidance".

🟢 The wiki asks this one: why should the detected value be over 2cm? Test it and write your answer.
Show the sonar number on the screen → Hold your hand right against the sensor → Read what it says → Explain what that does to the test
🟡 Build a box maze and get the car through it without touching a wall.
Lay out a route with two turns → Run it and watch where it fails → Change one number → Run it again
🔴 Make it turn left instead of right, and say which way escapes your maze better.
Find the two motor numbers that set the turn → Swap them → Run the same maze → Say which side won and why
cutebot_ultrasonic

Measures how far away the thing in front of the car is.

basic.forever(function () {
    basic.showNumber(cuteBot.ultrasonic(cuteBot.SonarUnit.Centimeters))
    basic.pause(500)
})

You see: A number in centimeters or inches — the sonar reads from 2 cm to 400 cm.

logic_and

True only when both tests are true.

if (input.buttonIsPressed(Button.A) && input.buttonIsPressed(Button.B)) {
    cuteBot.stopcar()
}

You see: True or false for the pair of tests together.

Answer key

Conceptc1 → B, c2 → D
Readingr1 → B, r2 → B, r3 → B
Debugd1 → C, d2 → B
Buildingb1 → B, b2 → B

Talk rubric

Strong — says a single test lets untrustworthy readings near zero count as obstacles, so the lower end throws out noise and only real, in-range measurements trigger the turn. Developing — mentions the second test but not what it protects against. Needs Focus — says one test is enough, or describes the upper end only.

A week later

These questions are not on the check-up page. They come back in the next chapter's Warm-up, five days or more after the check-up — with one new program on the same idea each.

Concept 3 🗓️ Comes back a week laterWhy does the test check Sonar > 1 as well as Sonar < 20? → A Because the very smallest readings are not trustworthy
· New code (same idea)The room is empty, but the sonar reads 0. Why does the test Sonar < 20 and Sonar > 1 ignore it? → B A reading that small is noise, not a real wall
Reading 2 🗓️ Comes back a week laterA box is 12cm ahead. What do the wheels do? → B The left stops and the right reverses, so the car swings aside
· New code (same idea)A box is 25cm ahead. What does the car do? → C Backs away