The Robot Brain
A robot's controller follows a program. Learn how programs use clear steps, if-then rules and loops, and find the bug in a robot's instructions.
Welcome back!
Step 1 of 13Learn
The controller
A robot's brain is a small computer called the controller. It reads the sensors, runs the program and tells the motors what to do.
A program is a list of instructions written by people called programmers. The robot follows the instructions exactly. It does not guess what you meant.
If you tell a robot "go forward" but never say "stop," it will drive until it hits the wall!
Step 2 of 13Practice · Put in order
Put this program in order so a robot brings you a ball.
Drag the items, or use the arrow buttons, to put them in order.
- Drive back to you
- Open the gripper
- Close the gripper around the ball
- Drive to the ball
- Open the gripper to drop the ball
Step 3 of 13Learn
If-then rules
Robots make decisions with if-then rules. An if-then rule checks a sensor and picks an action.
- If the bumper is pressed, then back up and turn.
- If the floor sensor sees black, then steer left.
- If the battery is low, then drive to the charger.
A program can have lots of these rules. Together they make the robot seem smart, even though each rule is simple.
Step 4 of 13Practice · Choose one
A rule says: "If the distance sensor sees something closer than 10 centimeters, then stop." The robot is 30 centimeters from a wall. What does it do?
Step 5 of 13Practice · Diagram
A robot's if-then choices
The battery is full and the bumper is pressed. Tap what the robot does.
Tap the shape that answers the question, then press Check.
- Is the battery low?
- Yes: drive to the charger
- No: is the bumper pressed?
- Yes: back up and turn
- No: keep driving
Step 6 of 13Learn
Loops repeat
Imagine writing "check the bumper" a million times. That would take forever! Instead, programs use loops. A loop repeats steps again and again.
A robot vacuum's program is mostly one big loop: check sensors, decide, move, then start over. It might run that loop many times every second until the floor is clean or the battery is low.
Step 7 of 13Diagram
One big loop
- Check sensors
- Decide
- Move
Step 8 of 13Practice · Work it out
A robot dance program says: "Repeat 4 times: spin, then clap." How many claps happen?
Step 9 of 13Practice · Match the pairs
Match each program idea to an example.
Tap an answer, then tap the place where it belongs (or drag it there).
- Step
- If-then rule
- Loop
- Bug
Step 10 of 13Note
Step 11 of 13Compare
Rules robot or AI robot?
| Aspect | Rules robot | AI robot |
|---|---|---|
| Who makes the rules | A programmer writes each one | It learns from many examples |
| Example | Stop if the bumper is pressed | Spot a cat in a photo |
| Has feelings | No | No |
| Built and checked by | People | People |
Step 12 of 13Practice · What would you do?
What would you do?
Your robot is supposed to stop at the edge of the table, but it drives off. What is the best first thing to do?
Step 13 of 13Practice · True or false
A robot follows its program exactly, even if the program has a mistake.
Lesson complete!