# Case 02: Line-following Cars ## Purpose --- To make a line following car. ![](./images/case-02-01.png) ## Link --- [micro:bit Wonder Building Kit](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-32-in-1-wonder-building-kit-without-micro-bit-board?_pos=5&_sid=2094afd2f&_ss=r) ## Materials Required --- ![](./images/case-02-02.png) Video link: [https://youtu.be/J2QKDKnTklw](https://youtu.be/J2QKDKnTklw) ## 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) ## Installation Mthods of Hardwares Install the dual-line tracking sensor with the bricks. ![](./images/Wonder-Building-Kit-step-line-following.png) ## Hardware Connection Connect two [motors](https://www.elecfreaks.com/geekservo-motor-2kg-compatible-with-lego.html) to M1 and M2, the [dual line-following](https://www.elecfreaks.com/octopus-2-channel-tracking-module.html) sensor to P1 and P2 ports on [Wukong breakout board](https://www.elecfreaks.com/wukong-board-with-lego-holder-for-micro-bit.html). ![](./images/Wonder-Building-Kit-case-02-06.png) ## Software Platform --- [MakeCode](https://makecode.microbit.org/) ## 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](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.