The key task of today's lesson is to program the robot to stop on a third black line. The students will face a lot of challenges here and will probably not cope with the task on their own.
- 30 Mar 2018
In most cases the program they will make will look somewhat similar to the following one:
Now you should interrupt students and together discuss how to properly program the robot to stop on the third black line and find the issue with the program at hand. Highlight that their program is technically correct. Then, you can go through the program together, as if you were the robot and execute all the commands in the program. You should point out that after the robot stops on a black line for the first time, its next starting point is already a black line. So, the second time the program runs, the robot travels no distance because it is already on black.
In order to be sure that the robot has detected a new line and not the old one, robots must reach the end of the line.
Younger or impatient students will program the move block to go forward for a fraction of rotation or for a few seconds. That is a totally valid solution. Give them time to experiment and see how it works.
Then, show them the drawback that solution has when the lines have different width or when the space between the lines is less than the distance the robot moves blindly. The period when a robot uses rotations, degrees or seconds is the time when the robot is deaf, blind and feels nothing.
A universal approach to the challenge is to sense when one line ends and when another one starts.
To make sure that the black line detected by the sensor is a new one, students have to add a wait block to wait for a color other than black. Therefore, the final program should look like this:
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons