This lesson learns how to use the tracking sensor on the Tiny-bit microbit robot.
1.The position of the tracking module in the robot, as shown below.
!!!Note: In order to avoid the interference of sunlight on infrared sensor, we need to carry out this experiment indoors.
2. Learn about the principle of tracking module
The basic principle of the tracking sensor is to use the reflective nature of the object.
Our experiment is to tracking the black line. When the infrared light is emitted to the black line, it will be absorbed by the black line. When the infrared light is emitted to the other color line, it will reflected to the infrared receiver tube.
From the hardware interface manual, we can know that the tracking sensor is directly driven by the micro:bit P13,P14 pin.
Programming and downloading：
1.You should open the Mu software, and enter the code in the edit window, , as shown in Figure 7-1.
Note! All English and symbols should be entered in English, and the last line must be a space.
2.As shown in Figure 7-2, you need to click the Check button to check if our code has an error. If a line appears with a cursor or an underscore, the program indicating this line is wrong.
4. After downloading the program,
when left and right tracking sensor of Tiny-bit detect the black line, the two LED lights are yellow;
When the left line sensor of Tiny-bit detects a black line and the right tracking sensor does not detect a black line, the left LED light is yellow and the right LED light is blue;
When the left line sensor of Tiny-bit does not detect the black line and the right tracking sensor detects the black line, the left LED light is blue, and the right LED light is yellow;
when left and right tracking sensor of Tiny-bit do not detect the black line, the two LED lights are blue;
The code of the experiment: 7.Blackline control light.zip
Micro python Robot Course：
- Micro python Robot Course 1: Light up a LED
- Micro python Robot Course 2: LED light exchange lighting
- Micro python Robot Course 3.Breathing light
- Micro python Robot Course 4: Whistle
- Micro python Robot Course 5: Play《Little Star》
- Micro python Robot Course 6: Sound sensor
- Micro python Robot Course 7: Black line control light
- Micro python Robot Course 8: Measuring worker