Path Finder Challenge
Your next mission is to revise your robot to be able to follow the climbers up the mountain. As climbers ascend Everest, they create a trail in the snow. We will be using a black line to represent the packed snow left behind by climbers.
Build attachments and design a program for your robot that will allow your robot to follow a black line.
Build attachments and design a program for your robot that will allow your robot to follow a black line.
Attachment: Light Sensor
In order to see a line on the ground, which way will the sensor need to point?
Tip: Use your instruction manual to build an attachment for the light sensor.
Tip: Use your instruction manual to build an attachment for the light sensor.
Program: Line Follower
1. Create a Loop. Your whole program will go inside the loop.
2. Move forward. "Forward" will be the direction that puts the light sensor in front. (Seeing eye dogs have their eyes in the front, right?) Depending on how your robot is built, you might have to tell the robot to go backward. Test your robot to make sure it is going in the right direction.
3. Wait for light. (See the picture below.)
4. Turn. To turn, one wheel will go forward, and one will go back.
5. Wait for dark.
- Add a LOOP block. You can find them in the menu beneath the WAIT blocks.
2. Move forward. "Forward" will be the direction that puts the light sensor in front. (Seeing eye dogs have their eyes in the front, right?) Depending on how your robot is built, you might have to tell the robot to go backward. Test your robot to make sure it is going in the right direction.
- Add a MOVE block
- Make sure the motors are connected to the ports you are talking to. (In the example, our motors are connected to Ports C and B.)
- Instead of moving "1 Rotation," tell the motors to go "Unlimited". This means they will go forever (until the robot sees white.)
- Change the speed to 25. If your robot goes too fast, it might not see the line.
3. Wait for light. (See the picture below.)
- Add a WAIT FOR LIGHT SENSOR block
- Make sure the sensor is connected to the port you are talking to. (In the example, our light sensor is connected to Port 1.)
- Change the sensor to look for light GREATER THAN < 60. You want it to look for a dark line, so the light level will be low.
4. Turn. To turn, one wheel will go forward, and one will go back.
- Insert 2 MOVE blocks, one that only talks to one motor and tells it to go forward, and one that only talks to the other and tells it to go backward.
- Both move blocks should be "Unlimited"
- Change the speed to 25, so it doesn't outrun itself.
5. Wait for dark.
- Add a WAIT FOR LIGHT SENSOR block
- Make sure the sensor is connected to the port you are talking to. (In the example, our light sensor is connected to Port 1.)
- Change the sensor to look for light LESS THAN < 60. You want it to look for a dark line, so the light level will be low.