Sound the alarm! Learn how to make lights and sounds
In this project students use both lights and sound to recreate their own version of a police car siren. The step-by-step instructions in the tutorial guide students through the process of building the circuit and writing the code. To make this an interactive game, challenge students to borrow code from other projects. What happens when the button is pressed?
In this project, students will learn how to use columns of the breadboard to provide a ground connection to two LED lights with one wire. The short sides of both LED's are placed in the same column as the Blue jumper wire, meaning they are both connected to it.
This is the first project where we introduce events, a key programming skill. All components of the event block will play when you push the button! The event is activated by an input from Pin 8 which is connected to the push button. The code block When Pin eight turns On is creating the event and all code blocks inserted inside it will occur when the button is pushed. An example of playing music is provided as blocks to add inside the event, but students should be encouraged to try other things such as flashing lights, or playing different sounds.
Other key skills used in this project are sounds, timer and sequences.Set up a couple of lights to blink. They can share the ground wire (short side).
Add this code to get those lights blinking.
Add the Pin Turns On event, and set it to pin 26.
Connect our event button to pin 26 & 30.
Anything in the event block will play when you push the button. Try sounds!