mohammadsohail0008
Published © GPL3+

Police Siren & Lights for your Arduino car

Police siren lights for your Bluetooth Arduino car

IntermediateFull instructions provided8,766
Police Siren & Lights for your Arduino car

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Speaker: 0.25W, 8 ohms
Speaker: 0.25W, 8 ohms
×1
5 mm LED: Red
5 mm LED: Red
×2
LED, Blue
LED, Blue
×2
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Android device
Android device
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

For 1st project

For 2nd Project

Code

For 1st project

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Police siren with lights //
// By MOHD SOHAIL //

int blue = A4;
int red = A5;
int speaker =2;
int t=60;
int i=0;

void setup() {
 Serial.begin(9600);
 pinMode(2, OUTPUT); 
  pinMode(A5, OUTPUT);
  pinMode(A4, OUTPUT);
}

void loop() {
   
   digitalWrite(A4,HIGH);             // for police siren lights
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);


    for(i=700;i<800;i++){   // for police siren
  tone(2,i);
  delay(15);
  }
  for(i=800;i>700;i--){
  tone(2,i);
  delay(15);
  }
  }

For 2nd Project

Arduino
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// police siren via bluetooth module //
// By MOHD SOHAIL //

int blue = A4;
int red = A5;
int speaker =2;

int t=60;
int i=0;

char command; 

void setup() 
{       
  Serial.begin(9600);
  pinMode(2, OUTPUT); 
  pinMode(A5, OUTPUT);
  pinMode(A4, OUTPUT);
}

void loop() 
{
  while(Serial.available() > 0){ 
    command = Serial.read(); 

    switch(command){
          case 'c':      // Siren on
      sirenon();
      break;
    case 'd':      // Siren off
      sirenoff();
      break;
    case 'a':      // Siren leds on
      sirenledon();
      break;
    case 'b':      // Siren leds off
      sirenledoff();
      break;
    }
}
}

void sirenledon ()
{
   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);

   digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);

  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
 
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
 
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  
  digitalWrite(A5,HIGH);
  
  delay(t);
  
  digitalWrite(A4,LOW);
  
  digitalWrite(A5,LOW);
  
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  
  digitalWrite(A4,HIGH);
  delay(t);
  digitalWrite(A4,LOW);
  digitalWrite(A5,HIGH);
  delay(t);
  digitalWrite(A5,LOW);
  delay(t);
  }

  void sirenledoff ()
{
  digitalWrite( A4, LOW); 
  digitalWrite( A5 , LOW); 
}

void sirenon ()
{
  for(i=700;i<800;i++){
  tone(2,i);
  delay(15);
  }
  for(i=800;i>700;i--){
  tone(2,i);
  delay(15);
  }
}
void sirenoff ()
{
  digitalWrite(2 , LOW); 
  noTone(2);
}

Credits

mohammadsohail0008

mohammadsohail0008

42 projects • 31 followers

Comments