4. Case 02: Line-following Cars#

4.1. Purpose#


To make a line following car.

../../_images/case-02-01.png

4.3. Materials Required#


../../_images/case-02-02.png

Video link: https://youtu.be/J2QKDKnTklw

4.4. Bricks build-up#


../../_images/step-case-02-01.png

../../_images/step-case-02-02.png

../../_images/step-case-02-03.png

../../_images/step-case-02-04.png

../../_images/step-case-02-05.png

../../_images/step-case-02-06.png

../../_images/step-case-02-07.png

../../_images/step-case-02-08.png

4.5. Installation Mthods of Hardwares#

Install the dual-line tracking sensor with the bricks.

../../_images/Wonder-Building-Kit-step-line-following.png

4.6. Hardware Connection#

Connect two motors to M1 and M2, the dual line-following sensor to P1 and P2 ports on Wukong breakout board.

../../_images/Wonder-Building-Kit-case-02-06.png

4.7. Software Platform#


MakeCode

4.8. Coding#


Add extensions#

Click “Advanced” in the MakeCode to see more choices.

../../_images/case-01-03.png

Search with Wukong in the dialogue box to download it.

../../_images/case-01-04.png

Program#

../../_images/case-02-05.png

Link:https://makecode.microbit.org/_azffEJVztHiW

Result#

The car moves along with the maps at a uniform speed, it will keep its speed and directions if it deviates from the black line until it goes back.