Skip to main content

Case 10 Automatic Line Patrol


This course aims to let students understand the working principle of the line tracking sensor by making a smart line tracking car.

Teaching Objectives

Understand the basic concepts of programming, such as judgment, branch, and or not, etc.

Understand the working principle and application of line-following sensors.

Can use Cutebot Pro smart racing car to make a car that can follow the line.

Teaching Preparation

Cutebot Pro × 1

micro:bit × 1

Teaching Process

Course Introduction

Hello everyone! Today we are going to introduce a very interesting project - making a smart line-following car. The little car can drive along the black lines.

Inquiry Activities

How does the line tracking sensor work, how does it detect black lines?

What programming building blocks might we use when designing the line patrol car?

What are the possible application scenarios of the line patrol car in daily life?

According to the working principle of the line inspection sensor, what other fields can we apply it to?

Sample Code


You can also download the program directly from the following web page.

Summary and Reflection

Review course content to remind students of what knowledge and skills they have acquired.

Guide students to discuss the problems and difficulties they encountered in the production process, and how to solve these problems.

Encourage students to think about the application fields and future development of smart car production cases.

Outreach Activities

Let the students try to improve the line-following function of the smart car so that it can handle more complex lines.

Encourage students to design other integrated use cases of sensors and line patrol cars, such as ultrasonic sensors.

Guide students to think and discuss the practical application and future development prospects of smart racing cars in daily life.