Skip to main content

Case 30 The Traffic Light


In this project we will be making a model of a traffic light using the Nezha Inventor's Kit V2. We will learn about the control and programming of LED lights and apply them to the production of a traffic light.

Teaching Objectives

  • Master the use and control of LED lights
  • Learn to program traffic light on/off and change sequences using Nezha Inventor's Kit V2
  • Develop creativity and innovative thinking

Teaching Preparation

Nezha Inventor's Kit V2

Teaching Process


Introduce students to the background and objectives of traffic light making to stimulate their interest and curiosity.

Traffic lights play a very important role in our daily lives as they control the flow of traffic and ensure road safety. Imagine how interesting and useful an invention it would be if we could make our own model of a traffic light and control its light-up and light-down state and change sequence?


Discuss in groups and get students thinking about how to make a traffic light using block materials.

  • How can the LED lights be programmed to control their on/off state?
  • How can you program a traffic light change sequence, e.g. red light on -> green light on -> yellow light on -> red light on cycle?
  • How to get creative and design a unique traffic light look and change sequence?


Work in groups to create a traffic light using block materials according to your own design.

Make a traffic light out of blocks according to your own design.


Building Steps


Hardware Connection

Connect the green LED to connector J1, the yellow LED to J2 and the red LED to connector J3 of the Nezha expansion board.


Go to makecode

Create new projects

Click extensions

Search with planetX to download the package.



You may download it directly:


Present in groups and compare the results and effectiveness of each group.


The green light comes on for 5 seconds and the red light comes on for 5 seconds, alternating with the yellow light coming on for 2 seconds in between each switch.


Share in groups so that students in each group can share their production process and insights, summarise the problems and solutions they encountered, and evaluate their strengths and weaknesses.