Lesson #6: Add a Distance Sensor to the Car


Goal:

  • Learn how to use the distance sensor.
  • Learn about the Wait-Until block.
  • Learn about the Forever block
  • Learn how to change the speed of car while it is moving

Concepts:

  • Sensor limits.
  • Sensor field-of-view.
  • Program logic: If-Then, Until, While, Repeat-Forever
  • Conditions

Materials:

Two-wheel drive car used in last lesson.


Preparation:

Add the distance sensor to the car by following this construction method:


Procedure:


  1. Program the car to stop when it approaches an object.
  2. Program the car to slow down as it approaches an object before it finally stops.
  3. Program the car to reverse and change direction when it encounters an object.

Homework:

Let the robot “explore” different spaces in your house. You may want to change the amount of back-up and turning.