"> ");
Hello kids!
In this lesson, we will make Edison run on a white surface.
But should he keep running all the time?
We will make it stop when it encounters with a black line. We will do all this by writing our program!
Do you remember Edison’s line tracking sensor?
It is the sensor with which Edison “understands” whether he is above a dark or a light surface.
So we can create a program that uses this sensor and tells Edison to drive forward on a white surface but to stop when he encounters with a black surface.
To write our program we will use EdBlocks. Let’s find EdBlocks app. On our computer, we type www.edblocksapp.com in a browser. Another way is to look for the word Edblocksapp on a search engine machine.
Using Edblocks we will write our program so that Edison drives forward on a white surface and stops as soon as it encounters with a black surface.
Let’s look at it a little bit more in detail to make a list:
We want the robot to drive forward on a white surface... then wait until a black surface is detected and then... to stop.
Perfect! We have made the list of all the things we want Edison to do.
Now we have to tell him all of them... but in order for the robot to understand them we have to write them in its language with Edblocks!
So we choose the block, from the “drive” category, with which Edison drives forward on a white surface.
Good!
Then we choose, from the “wait until” category, the block with which Edison waits for something to happen.
By clicking on the arrow, we select the black line.
Perfect! Now Edison will wait until a black surface is detected. And then we want him to stop.
That is why we choose from the category “drive” the block with the stop signal.
Very nice! We wrote our program and it’s time to test it.
We will need a track that we will find in the accompanying document titled “Resources”.
After downloading the program to Edison, we place the robot on the white surface of the track and we press the play button...
We notice that the robot drives forward and as soon as it meets the black line, it stops.
Our track has three more lines: A red, a blue and a green one.
Let’s try all of them.
We notice that our robot stopped at the blue and green line, but not at the red line… it continued normally, like if it hadn’t “seen” it at all. But why did this happen?
Let’s take a look at our robot’s line tracking sensor. The color of the light emitted is red.
When it encounters with the red line, this reflects the red light back to the robot.
So the robot does not understand that it is on a dark surface that doesn’t reflect the light at all, and it continues normally. However, the green and the blue color, do not reflect the red light at all. So the robot stops, exactly as it does in the black color.