Case 30 The Traffic Light
Introduction
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
Teaching Process
Introduce
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?
Exploration
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?
Practice
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.
Examples
Building Steps
Completed
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.
Programming
Go to makecode
Create new projects
Click extensions
Search with planetX
to download the package.
Code
Link: https://makecode.microbit.org/_Wv0gDTaTUY88
You may download it directly:
Demonstration
Present in groups and compare the results and effectiveness of each group.
Result
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.
Reflection
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.