After you have discussed the line following task, the students have a few exercises that will lead them to the final line following program. During the exercises students may face the following problems:

To access the full video please subscribe to FLLCasts.com
- #856
- 30 Mar 2018
- If the sensor reads black, move the left motor 1 rotation forward. It is important to note that the evaluation happens at the moment the program is started. In order to test the program, you should put the robot over the black line and then run the program. The robot should make one rotation with the left motor. Afterward, put the robot outside of the black line and run the program. The robot should not move in that case.
- If the sensor reads black, move the left motor 1 rotation forward, otherwise move the right motor 1 rotation forward. Here, you have to watch out for the same issue, as in the first exercise.
- Repeat the above program in a loop. When the switch is put inside a loop, the evaluation will be held after each rotation, not constantly. This will result in the robot easily losing the line by passing it. In order to overcome this issue, the move blocks should be set to On, instead of On for Rotation. The next issue that will arise from that change is that the robot will start going forward after the first iteration of the loop. This happens because students do not turn off the first motor before they turn on the second one. When the condition changes, we start the second motor but we do not stop the first one and the robot starts moving straight forward. This could be solved by adding another move block, set to Off, in each of the switch states. So, in the end the program should look like that:
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Robotics with LEGO - Level 1.5 - Spy games
The second level of the Robotics with LEGO curriculum for students from fifth to twelfth grades.
Students build multiple robots with thread chains and become familiar with the physical concepts of momentum and center of gravity. The concept of gears, their use and basic constructions involving gears are studied.
The new concept of "condition" is introduced in programming. Robots are becoming smarter as they can make complex decisions on their own. "Spy robots" follow their targets and avoid being noticed. This level introduces the light sensor which the robots use to recognize the colors of the objects they are looking for. Robots can stop on a black line and follow a route marked with a colored line on the floor.
The spy's most complex mission in the end of the level is to turn into a sumo wrestler and defeat any other robot in the ring.
- 56
- 12:47
- 135

Line following tasks
In the next tutorial, students will be able to find an illustrated explanation of how to program the robot to follow a line. However, it will be best if you initiate a discussion on the topic before reading the material. Talk about different approaches that could be used, what the possible challenges that one may face are, etc. Usually, students will easily reach the conclusion that the robot should go forward if on black and turn towards the line if on white. Try to explain to them that in such cases it will be impossible for the robot to know if it should turn left or right and that is the reason why we do not follow the line, but its edge.
- 2
- 0
- 4
- 3d_rotation 0

Level B2. "Military Technologies". Robotics with LEGO
The firfth level of the Robotics with LEGO curriculum for students in second, third or fourth grades.
The students build many robots with chain-treads. The Color Sensor is introduced and robots use it to recognize the colors of the objects around them. Students learn about gears, basic gear constructions, and their application. Robots now can stop on a black line and can follow a line using their sensor.
- 37
- 6:37
- 111

Level B2. "Military Technologies". Robotics with LEGO
The firfth level of the Robotics with LEGO curriculum for students in second, third or fourth grades.
The students build many robots with chain-treads. The Color Sensor is introduced and robots use it to recognize the colors of the objects around them. Students learn about gears, basic gear constructions, and their application. Robots now can stop on a black line and can follow a line using their sensor.
- 37
- 6:37
- 111

Lesson 6 - Line Following
In the next lesson we usually do a graduation. Write down your impressions about the students and the reasons why they have the grades you gave them.
- 5
- 3
- 9
- 3d_rotation 1