The big ideaA sensor tells a robot about the world, so its program can react.
How it works
A sensor tells a robot about the world.
A program can only use what its robot can sense.
A color sensor tells colors apart. A touch sensor tells when something pushes it.
The program uses an if to react to what a sensor says.
Two rules, one for each sensor.
Example 1: No sensor
Bo's rule is follow the road, and if the floor is yellow, stop.
Bo cannot tell yellow from blue.
He rolls right over the yellow tile.
Example 2: A color sensor
A color sensor shines a little light down and measures what bounces back.
Yellow bounces back differently from blue.
The sensor says yellow, so the if is true and Bo stops on the tile.
Line 2 uses the color sensor.
Example 3: A touch sensor
A touch sensor is a little button on the front.
Bo meets the wall, the button clicks, and the program asks if it is pressed.
It is, so Bo backs away, turns and rolls on.
Example 4: Which sensor?
Priya wants Bo to stop on yellow and to back away from the wall.
Yellow needs a color sensor, and the wall needs a touch sensor.
So Bo needs 2 kinds of sensor.
Words to know
sensor
A part that tells a robot about the world.
color sensor
Tells colors apart.
touch sensor
Clicks when something pushes it.
react
To do something because of what a sensor says.
Watch out
A robot cannot react to something it cannot sense. No sensor, no reaction.
A touch sensor cannot tell blue from yellow. A color sensor does that.
A sensor only gives information. The program uses an if to react.
A sensor is not a motor. A motor makes a robot move.
Try it
Which sensor tells a blue tile from a yellow tile?
Which sensor notices that Bo bumped a wall?
Can a robot react to a color with no sensor?
Which sensor does Bo need to hear a loud clap?
What does a program use to react to a sensor's answer?
Answers: 1. A color sensor · 2. A touch sensor · 3. No · 4. A sound sensor · 5. An if
Try at homeIn a clear room, play robot with a grown-up. Close your eyes for a few slow steps. Your grown-up is the program and uses only what you can sense. Try a touch rule: if you feel the wall, turn around. Which senses did you use?
For grown-upsDo the Mission: in a clear room, play robot together. Close your eyes for a few slow steps while your grown-up is the program. Try a touch rule: if you feel the wall, turn around. Which senses did you use?
Open these notes on screenScan the code, or go to tutorpip.com.