Muhammad_Munir
Published © GPL3+

Police Lights

How to make Police Lights by using Arduino

BeginnerFull instructions provided167
Police Lights

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Blue LEDs
×3
Red LEDs
×1
Jumper Wires
×1
Bread Board
×1

Story

Read more

Code

Code

Arduino
const int red = 2;
const int blue = A4;

void setup() {

  pinMode(red, OUTPUT);
  pinMode(blue, OUTPUT);
}


void loop() {
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(500);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(00);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(200);

digitalWrite(blue, LOW);
  digitalWrite(red, LOW);
  delay(200);
  digitalWrite(red, HIGH);
  delay(200);
    digitalWrite(red, LOW);
  delay(200);
  digitalWrite(red, HIGH);
  delay(200);
    digitalWrite(red, LOW);
  delay(200);
  digitalWrite(red, HIGH);
  delay(200);

   digitalWrite(red, LOW);
   digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(blue, HIGH);
  delay(200);
    digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(blue, HIGH);
  delay(200);
    digitalWrite(blue, LOW);
  delay(200);
  digitalWrite(blue, HIGH);
  delay(500);
}

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments