Getting started: use infrared sensor, four digit digital tube and dot matrix screen to complete the basic project of traffic flow display.
Advanced: adjust the logic of traffic lights when the traffic flow reaches a certain saturation level
High order: automatic association of traffic flow and traffic lights, comprehensive application. Countdown time setting.
Experiment: none at present.
1.Teaching objectives (knowledge preparation)
Know the infrared sensor and be able to use the infrared sensor to detect whether the vehicle passes.
The vehicle detection can be realized by programming, and the value can be displayed by four digital nixie tubes.
Be able to apply project equipment in combination with life application scenarios.
2.Teaching tasks
The infrared sensor and four-way digital tube are used to realize the vehicle passing detection, record and display the vehicle value.

3.Preparation of teaching environment and equipment
Equipment List: Image (with label number 123456)
Equipment Serial Number Table
| Serial number | number | equipment | Specifications | quantity |
| 1 | Obstacle Avoidance Detection | 1 | ||
| 2 | Four digit digital tube | 1 | ||
| 3 | Matrix Display | 1 | ||
Software: Smart Code programming software.
Hardware: SMART Code kit: Sound intensity sensor, four digit digital tube.
Other: Several building block devices.
Detailed List of Structural Components
| Serial number | number | equipment | Specifications | quantity |
| 1 | 3-hole beam | 18 | ||
| 2 | 7-hole beam | 6 | ||
| 3 | 13-hole beam | 6 | ||
| 4 | T-shaped beam | 6 | ||
| 5 | Black sales | 54 |
Note: Materials required to fix a set of sensors: 6 3-hole beams, 2 7-hole beams, 2 13 hole beams, 2 T-shaped beams, and 18 black pins.
4.Project Practice Process
(Summary of Knowledge Points: 1. Components. 2. Program Modules. 3. Program Design)
1.Project video (in video format)
2.Project Steps
1.Fix the infrared sensor, four digit digital tube and dot matrix screen according to the list of items.
2.Determine the fixed position of the infrared sensor to ensure that passing vehicles can be detected.
3.The dot matrix screen displays the status of the detection area, with and without vehicles.
4.The four digit digital tube completes the vehicle counting function.
5.Complete structural fixation.
6.Use smart code programming software to complete the programming design.
First, create a program entry. The example code is as follows:
Then, the vehicle monitoring of infrared sensor is programmed to detect whether the vehicle passes. The example code is as follows:
Then, the status of whether the vehicle passes or not is programmed and displayed on the dot matrix screen. The status of whether the vehicle passes or not is displayed when there is a vehicle, and the status of whether the vehicle passes or not is displayed when there is no vehicle. The example code is as follows:
Then, the number of vehicles passing through is programmed and displayed on the four-way digital tube. The example code is as follows:
Finally, complete all the codes. The example code is as follows:

7.Run the program, debug the switch and use..
8.Optimization and improvement plan.
9.Interesting thinking: when the traffic flow reaches a certain amount, the dot matrix screen displays different patterns.
3.Reflection and discussion:
Experimental results
Data records: Table 1 and Table 2
Experimental conclusion:
5.Extension and Expansion
Reflection and exploration:
Question 1:
Question 2:
