We should all know how to follow a line in the most simple way possible. If the sensor detects that it is not above a line, the robot turns to the line. If the sensor detects that it is over the line, it turns away from it. But let's do this with a Switch Block.

To access the full video please subscribe to FLLCasts.com
- #1257
- 08 May 2019
The logic of the program is the same and even better. This variant of the line following with a Switch Block does is not influenced by the color of the floor, but only by the color of the line. We start by placing a Switch block that checks if the surface below the sensor is black.
If it is black we turn left/right:
If it is not black we turn the other way:
At the end we put everything in a loop and our robot is ready to follow a line. Be careful to configure all the motor blocks that make the robot turn to have the settings 'ON'. If we use blocks for only one motor, we should stop this motor, in the case where it should not move. Otherwise your robot will not turn.
Why are we using a Switch Block? The greatest advantage of this variant of following a line is that in this case the robot program does not block and wait. When we use Wait blocks, everything in the loop waits one block to complete and then execute another block. But in this variant because the Switch block completes right a way, there is no wait. This allows us to also do other checks in the loop.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Level D2. "Seafaring". Robotics with LEGO
The eighth level of the Robotics with LEGO curriculum for students in third or fourth grade.
In this level, students learn to use the fourth sensor in the robotics set - the gyro sensor. The robots are modeled after boats, yachts, and ships. With the help of the gyro sensor, students can set a course for their robots to a given angle and can detect deviations from the course. In open seas, there may be sea-monsters and the robots are being programmed to detect a sudden change in acceleration with the help of the said sensor.
- 24
- 2:49
- 107

Lesson 4 - Yacht
Introduction
Let's imagine we are billionaires. Every self respected billionaire must have a yacht . A robot yacht is exactly what we would now build.
The modern yachts are custom build for a luxury life. They could have a bathroom, bedroom with a nice view, living room, kitchen and even a room for play.
What would you like to have on the board of your yacht? Why?
All of this of course has a price. If we are slightly less rich billionaires we would take a yacht starting at about $200,000. And the price could go up indefinitely. There is a rumor that the most expensive yacht is for over $4,000,000,000 dollars. It was made with more than 100,000 tons of gold and platinum - two of the most expensive materials on earth. There are walls made from real tyrannosaur rex bones and diamonds each costing 45 million dollars. Luckily, we are also billionaires and we could afford all of this. We would leave up to you to decide if you need a wall full of tyrannosaur Rex bones.
- 4
- 5
- 8
- 3d_rotation 1