background image

After the above procedure is executed, you will find that the car always turns in one direction 
after encountering an obstacle. Below we will improve the program as follows, let the car 
encounter obstacles and randomly choose a turning direction to continue driving. 

In the program, a module that generates integers randomly is used to randomly produce 1 or 2. If 
it is judged that the random number is 1, then turn right, if the random number is 2, then turn left. 

Program Link: 

https://makecode.microbit.org/_JyKALkaeh5j5

 

 

6-4 Line-tracking Robot 

The function of the following program is: put the car on the circular black line map, the car will 
use the three line-tracking sensor probes set at the bottom to detect whether the car is driving on 
the black line. If it deviates from the black line, the car will correct its driving direction in real 
time so that the car will always follow the black line. 

There are 5 line-tracking sensor probes in Maqueen Plus V2. In this program, three probes, L1, 
R1, and M, are used to detect black lines. L2 and R2 are not used yet. 

When the line-tracking probe detects a black line, the output value is 1, and when it detects a 
white line, the output value is 0. With this feature, three line-tracking sensors can be used to 
detect the black lines, and the status of multiple probes can be used to determine the position of 
the black line in real time and how the car should turn to correct deviation. 

Summary of Contents for MBT0021-EN

Page 1: ...unctions and stronger performance Whether you have ever used Maqueen series products or not you ll find it very easy to get started 2 Specification Power Supply o MBT0021 EN 1 5V AA alkaline battery x...

Page 2: ...3 Board Overview MBT0021 EN AA Battery Version MBT0021 EN 18650 18650 Version...

Page 3: ...able batteries are safer than lithium batteries and are less prone to explosion and fire The voltage is 1 2V per cell The size of the Ni MH battery is the same as that of the AA alkaline battery There...

Page 4: ...Step 2 Plug in the ultrasonic sensor Step 3 Insert the micro bit board Step 4 Connect the board to a PC via USB cable...

Page 5: ...B cable and turn on the power switch After the above operations we downloaded an automatic obstacle avoidance robot program to the board Put Maqueen Plus on the ground it will automatically drive forw...

Page 6: ...is used to indicate the intensity of light In the program we take a light intensity value of 100 as the demarcation point When the light intensity is greater than 100 the car is started otherwise the...

Page 7: ...to avoid the obstacle and continue driving In the program the distance read by the ultrasonic is assigned to a variable and then it is judged that if the value of this variable is less than 30 the tu...

Page 8: ...black line map the car will use the three line tracking sensor probes set at the bottom to detect whether the car is driving on the black line If it deviates from the black line the car will correct i...

Page 9: ...ke it will be difficult to return to find the black line to continue driving In the following procedure we will use five probes and add another layer of detection on the left and right sides so that t...

Page 10: ...tems of numeration hexadecimal and decimal In Maqueen PlusV2 we use decimal as the picture shows Example 1 In the following example we use the four buttons 2 4 6 and 8 of the infrared remote control t...

Page 11: ...ill fall backward due to the reaction force We try to optimize the code and operating experience Program Link https makecode microbit org _TboWd2ihjD2k In this example we have made some changes to the...

Page 12: ...e control handle and the two motherboards communicate through the wireless network to realize the remote control function Compared with infrared wireless communication has the characteristics of no di...

Page 13: ...power of the handle and the car Move the joystick on the left side of the handle to control the forward backward left and right turn of the car However you may find a problem we can only control the d...

Page 14: ...on the car side respectively Turn on the power of the handle and the car Gently push the joystick forward Maqueen Plus will gradually start and speed up Try turning around and going backward The speed...

Page 15: ...ognized normally then you can try to calibrate it Methods as below 1 Place the car on the black block of the map which delivered with the product and make sure that the 5 sensors are in the black area...

Page 16: ...er The picture shows the state of turning on the buzzer Flick to the other side to turn off the buzzer sound 9 Install HuskyLens Camera 1 Install the two copper pillars delivered by the product in the...

Page 17: ...3 Install the other bracket the bracket and mounting screws are provided with the HuskyLens product 4 Install HuskyLens AI camera 5 Plug in the AI camera connection...

Page 18: ...anic on the copper column with screws 3 Plug the connecting wire of the servo into any 5V port of P0 or P1 or P2 on the back and be careful not to plug it in the reverse direction FAQ For any question...

Reviews: