Microbit Robotics Teacher Training
Intermediate
60 mins
Teacher/Student led
260 points
What you need:
Chromebook/Laptop/PC
Microbit
Move Motor Car

Line Following Car

In this step-by-step lesson, you'll learn to program a Move Motor Car to follow a line track using a Microbit. You'll create a new project, add an extension, create variables, and set up LEDs. You'll then program the car to turn right, left, and move forward. Finally, you'll test your car on a track and tweak the code for optimal performance.
Learning Goals Learning Outcomes Teacher Notes Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Introduction

    In this project we will be programming the Move Motor Car to follow a line track.

    You will need the following:

    1. A Microbit
    2. A Move Motor Car (with 4 AA batteries)
    3. A USB cable
    4. A track drawn on paper or printed out using the attachment 'mbmmlfc tiles.pdf'

    If you are drawing your own track make sure you use a thick black marker with clear lines.

    2 - Create a new project

    Go to the https://makecode.microbit.org website and create a new project.

    3 - Add the extension

    We are going to programming a Microbit to act as the brains of the Move Motor car. To do this we will need to add the kitronik-move-motor extension to our project. This has custom blocks that let us program the Move Motor car.

    Add the kitronik-move-motor extension to your project. Once you add it you will notice that there is a new set of 'MOVE Motor' blocks in your toolbox.



    4 - Create the variables

    We need to create the following 3 variables:

    1. left - this will store the value of the left line sensor (how dark or bright it is).
    2. right - this will store the value of the right line sensor (how dark or bright it is).
    3. difference - this will store the value of the difference between the left and right variables.

    Create the 3 variables and then add the following code to your project.

    5 - Setup the LEDs

    To make the car look even better and to give us some extra feedback, we are going to use the LEDs on the Move Motor car to light up different colours depending on if it's going straight, left or right.

    Add the following code to your project to setup a variable for the LEDs.


    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more