Note:The sensors, modules and the 270° servo in each project are shared.
Project 02: Sound of Traffic Lights
1. Introduction
Today, I was walking home from school when I saw the traffic light beep at the intersection. Can we add a sound to the traffic light module in project 01? Let’s take a look at the tools first.
2. Components
Kidsuno Mainboard×1 |
Traffic Light Module×1 |
Active Buzzer×1 |
Connection Wire×2 |
USB Cable×1 |
Sound of Traffic Light×1 |
3. Assembly Steps
Download the PDF follow the link:Sound of Traffic Lights Assembly
Or you can Watch the assemble video :
4. Function: Make the Active Buzzer Sound
5. Wiring Diagram
Connect the mainboard and computer via a USB cable, and connect the traffic light module to the No.1 interface of the mainboard and the active buzzer to the No.9 interface of the mainboard.
6. Write the Program
① Drag the instruction block in the Events module to the script area.
② Drag the instruction block in the Pins module to the script area. Since the interface of the active buzzer module is connected to the D10 pin of interface 9 on the mainboard, then change the number 0 to 10 and the input to output.
③ Drag the instruction block in the Pins module to the script area and change the number 0 to 10.
④ Complete Program
7. Test Result
Click to upload the complete program to the kidsuno mainboard and power up, then the active buzzer will sound. It seems pretty amazing, right?
8. Function: Make the Active Buzzer Beep
9. Write the Program
① change the high in the previous program to low.
② Drag the instruction block in the “Control” module to the script area.
③ Drag the instruction block in the Pins module to the script area and change the number 0 to 10.
④ Drag the instruction block in the Control module to the script area. The number 1 can be changed to other numbers. Here, the number 0.5 is taken as an example.
⑤ Copy the code string once and change high to low .
⑥ Complete Program
10. Test Result
Click to upload the complete program to the kidsuno mainboard and power up, then the active buzzer will beep. It seems pretty amazing, right?
11. Function: Sound of Traffic Lights
12. Flow Chart
First the three LED lights will be off the buzzer will not beep, then the buzzer beeps and the red light flashes for 5 s then goes off , then the yellow light flashes for 3 times then goes off, then the green light will be on for 5 s then go off.
13. Write the Program
① Find the instruction blocks
(1)
(2)
(3)
② Complete Program
14. Test Result
Click to upload the complete program to the kidsuno mainboard and power up, then the buzzer beeps and the red light flashes for 5 s then it won’t beep and the light will be off , then the yellow light flashes for 3 times then goes off, then the green light will be on for 5 s then go off.
15. Extended Project
The sample code is below: