Simple line follow program

PRIMARY EDUCATION

Grade Level

COMPUTER SCIENCE

Subjects

mBot

Product

40MINS

Estimated duration
Longer description

Hardware requirements:

mBot

Implementation:

Upload the program to Arduino

Example programs

 

Script description
As black can absorb infrared light, then in consideration of Example 21 Value of the line-follower sensor, and we can let mBot identify a black track on a light-color surface or let mBot identify a light color track on a black surface .
Here we take a black track on a light color surface for exmaple to explain how to use a line-patroling sensor to make mBot move along a track.
The following introduces four situations where mBot is relative to the black line, which can be dealt with using the following strategies:
1, if it is on the black line, it keeps moving forward;
2, if it deviates from the black line, it turn left or right in time to keep itself on the line;
3, if it is not on the black line, it turns back to find the black line.

For the above four situations, the program can be the example:

 

Knowledge point
The line-patroling sensor is the best to identify pure white or black surface without reflection. Commonly you can use a black electrician tape to make a patroling line on a light color surface to achieve the best effects.

 

Extended tasks

Task 1 Change the speed of mBot when it is moving forward or turning. Observe mBot’s line patroling effects.
Task 2 Let’s think: In Situation 4, what strategy can mBot use to find the black line.

 

Attached – Line-patroling sensor structure diagram