My project is a button controlled siren with different LED transitions. You can change the sound of the siren with each press.
Devices and components
Arduino Uno Rev3
12mm push button switch
LED (generic)
Resistance 100 ohms
Breadboard (generic)
Jumper wires (generic)
Resistance 221 ohms
Buzzer
9V battery (generic)
10k ohm resistance
Project description
Code explained
one()
oneA()
delay()
How sync works
tone()
delay()
tone()
three()
void three() { //This function produces the 3rd siren (AMBULANCE sound).tone(buzz,440,200);
delay(300);
for(int i=3;i<=6;i++)
digitalWrite(i,HIGH);
noTone(buzz);
tone(buzz,494,500);
delay(300);
for(int i=3;i<=6;i++)
{ digitalWrite(i,LOW);
digitalWrite(i+6,HIGH); }
noTone(buzz);
tone(buzz,523,300);
delay(200);
digitalWrite(7,HIGH);
delay(50);
digitalWrite(8,HIGH);
delay(50);
noTone(buzz);
}
tone()
Arduino Siren Code
Here is the code!
Arduino Siren Code
Here is the code!
Downloadable files
Circuits and Connections
STEP A: (Connecting the LED)
Since we're basically building a mermaid, the red and blue flashes look cool. So take 5 red and 5 blue LEDs. Now connect the negative terminal of these LEDs with a 220 ohm resistor (current limiting) to the negative rail of the breadboard as shown in the circuit diagram. The positive ends of the red LEDs are connected to pin 3 to pin 7, while the positive ends of the blue LEDs are connected to pin 8 to pin 12 of the digital pin of Arduino.
STEP B: (Connecting the piezo buzzer)
Now it's time to connect our buzzer and the pushButton to the breadboard. Connect the piezo buzzer with a 100 ohm resistor to the negative rail and the positive end of the buzzer connected to pin 13.
STEP C: (Push button connection)
Connect one of the four push button pins to pin 2 and connect it to the GND rail using a 10,000 ohm pull down resistor. Connect the 5V with another button pin as shown in the circuit diagram.
Circuits and Connections
Circuits and Connections
STEP A: (Connecting the LED)
Since we're basically building a mermaid, the red and blue flashes look cool. So take 5 red and 5 blue LEDs. Now connect the negative terminal of these LEDs with a 220 ohm resistor (current limiting) to the negative rail of the breadboard as shown in the circuit diagram. The positive ends of the red LEDs are connected to pin 3 to pin 7, while the positive ends of the blue LEDs are connected to pin 8 to pin 12 of the digital pin of Arduino.
STEP B: (Connecting the piezo buzzer)
Now it's time to connect our buzzer and the pushButton to the breadboard. Connect the piezo buzzer with a 100 ohm resistor to the negative rail and the positive end of the buzzer connected to pin 13.
STEP C: (Push button connection)
Connect one of the four push button pins to pin 2 and connect it to the GND rail using a 10,000 ohm pull down resistor. Connect the 5V with another button pin as shown in the circuit diagram.
Circuits and Connections
Materials required
Materials required
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.