Final Project: Carpet City

Students will program their Final Project...Carpet City!
Students will program their robot to drive through a small carpet city. They will incorporate the skills they learned while programming Motion, Line Sensor, Ultrasonic Sensor and Light Sensor.

Model Video: Mobile or You Tube.

Hint #1: Look at the programs you wrote for "Line Sensor Task #3b Figure 8" AND "Task #1: Ultrasonic Sensor & Light Sensor: Guide Robot Thru Maze."

  1. Copy and paste these programs ("Line", "Light" and "Ultrasonic") into a "Forever" loop. I placed them in the following order: 1."Line", 2."Light" and 3."Ultrasonic."

Hint #2: Although all robots react differently, the following is code I used in my program...

  1. I have my robot turn right when it is triggered by the Ultrasonic and left when it is triggered by the Light Sensor. If the robot backs up and turns right after entering a box, then there is a good chance that the Ultrasonic Sensor was triggered before the Light Sensor was.
  2. Shadows: Notice that the boxes give off different shadows depending upon the classroom lighting and the angle of the boxes. I had to set my Light sensor to 500 in order to get it to trigger earlier becuase of the classroom lighting.
  3. Now all you have to do is adjust the time and speed. Also, look at the shadow created by the boxes from the ceiling lights - the shadow is different depending upon the direction the robot enters the box. You might have to adjust the Light Sensor intensity and/or the Ultrasonic Sensor distance values in your program; I set my Ultrasonic distance to "<4".


  • I will provide Carpet City, which will include the taped roads, road blocks and boxes.
  • Watch the Model Video above. Your goal is to write a program that allows your robot to follow the same route seen in the video.
  • You may not touch the robot or else you will need to start over.
  • The robot should not touch a wall or box or else it will need to start over.
  • After the robot completes an unsuccessful run, you may shift the boxes and walls to increase the chance that it does have a successful run!