Build a patrol system in three milestones, a robot and a base that talk both ways, then add an alert log and status lights.
Hospitals use robots to carry medicines along set routes, and farms use them to check fences. A person starts and stops them from a base and hears from them only when something is wrong.
The assistance challenge puts the course together in a patrol system. A robot follows the line (lesson 5) and stops when blocked (lesson 3). A base station starts and stops it by radio (lesson 7), and the robot reports problems back once (lesson 9). The robot remembers its job in a mode variable (lesson 6). You will build it in three milestones, with less help each time.
As in lesson 9, both micro:bits run the same program: press A+B to make one of them the base.
Make your prediction first. Help opens once you've locked it in.

function followLine () {
if (robot.detectLine(RobotLineDetector.Left) && robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 40)
} else if (robot.detectLine(RobotLineDetector.Left)) {
robot.motorTank(10, 40)
} else if (robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 10)
} else {
robot.motorStop()
}
}
robot.elecfreaksCuteBot.start()
basic.forever(function () {
if (robot.obstacleDistance() < 15) {
robot.motorStop()
} else {
followLine()
}
})
Drag a box onto the line in front of the robot, wait, then drag it away.

function followLine () {
if (robot.detectLine(RobotLineDetector.Left) && robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 40)
} else if (robot.detectLine(RobotLineDetector.Left)) {
robot.motorTank(10, 40)
} else if (robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 10)
} else {
robot.motorStop()
}
}
robot.elecfreaksCuteBot.start()
basic.forever(function () {
if (robot.obstacleDistance() < 15) {
robot.motorStop()
} else {
followLine()
}
})

function followLine () {
if (robot.detectLine(RobotLineDetector.Left) && robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 40)
} else if (robot.detectLine(RobotLineDetector.Left)) {
robot.motorTank(10, 40)
} else if (robot.detectLine(RobotLineDetector.Right)) {
robot.motorTank(40, 10)
} else {
robot.motorStop()
}
}
robot.elecfreaksCuteBot.start()
basic.forever(function () {
if (robot.obstacleDistance() < 15) {
robot.motorStop()
} else {
followLine()
}
})
Sort each job to the robot or the base.
Jack's robot, when it hears a message:

radio.onReceivedString(function (receivedString) {
if (receivedString == "go") {
followLine()
}
})
In the full patrol system, which jobs belong to the robot, and which to the base?
The robot follows the line from the moment it starts. Put the base in charge:
On the base: A sends the word go, B sends stop (send string, in Radio).
on radio received receivedString: if role = robot, then set mode to patrol for go, or stop for stop. Set mode to stop in on start.
In forever, inside the robot's if: if mode = patrol, follow the line; else, robot motor stop.
The base's A sends 'go' and B sends 'stop'; the robot patrols only while its mode is patrol.
This ticks by itself when your blocks do what is asked.
Make the robot report problems:
While patrolling: if the distance is less than 15, stop, and send 'blocked' if not alerted (then set alerted to true). Else send 'clear' if alerted, set alerted to false, and follow the line.
On the base, in on radio received: else if role = base, show an X and beep for 'blocked', and a tick for 'clear'.
The patrolling robot stops when blocked and tells the base once ('blocked', then 'clear'); the base shows an X and beeps, then a tick.
This ticks by itself when your blocks do what is asked.
Finish the system:
Then make it yours: a hospital delivery robot, a fence checker or a warehouse patrol. Change the messages and pictures to suit.
A variable alerts on the base: change by 1 for each 'blocked'. The logo shows it.
robot set color in three places: green while patrolling, red when blocked, off when stopped.
The base counts the alerts and shows the count on its logo; the robot's lights show green (patrolling), red (blocked) or off (stopped).
This ticks by itself when your blocks do what is asked.
Set up a tape loop and put a bare micro:bit with a person as the base (press A+B on it). Things to notice:
The assistance challenge. Students build a patrol system in three milestones (the base starts and stops the robot by radio, the robot reports blockages once, then an alert log and status lights), combining line following, distance, modes, roles and two-way radio. About 60 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
This is the assistance strand's challenge, using lessons 3 and 5 (distance and line), 6 (mode), 7 (radio commands) and 9 (roles and alert once). The key design rule: radio handlers only change the mode; forever drives the motors. A move made in a handler would be undone straight away by forever (or, like Jack's patrol, would only run once).
Both micro:bits run the same program; A+B makes one the base. The base's A sends "go", B sends "stop". The robot sends "blocked" (once, using alerted) and "clear". The milestones fade the help: Milestone 1 gives three numbered steps, Milestone 2 an outline, Milestone 3 goals only. Each starter is the previous milestone's solution. Showcase and Patrol and alert together mark the course Challenge complete.
The robots start near the line in the simulator; if one does not pick it up, drag it on. The logo needs a micro:bit V2 (shake works on V1).
Each side has its own job, and radio handlers only set the mode. Ask which part of the program drives the motors.
Stretch: Add a 'home' command: the base's logo sends 'home' and the robot turns round (a 'turn' mode that spins for 1.2 seconds, then goes back to patrol).
Support: Pair students for Milestone 2: one builds the robot side, one the base side, then they agree the words.
Real-world links: hospital delivery robots, farm fence checkers, warehouse robots, pipeline inspection. Discussion: what should the robot do when it cannot reach the base?