Introduction

In my last article, I explained about Remote Control using the Arduino Uno. In this article, I will explain about Police Strobe Light using Arduino.
List of Parts
  • 2 Red Led
  • 2 Blue Led
  • Arduino Uno
  • Potentiometer
  • Bread Board
  • Jumper Wires.
Connection
Step 1:
Connect the Arduino Uno board to the pc using a USB cable.
Step 2:
Fix LEDs and potentiometer in the bread board
Step 3:
POTENTIOMETER CONNECTION
Figure 1: Potentiometer
Step 4: Connect the potentiometer to the Arduino Board as in the preceding figure 1.
Step 5: Potentiometer Centre leads to Analog 0 pin in Arduino Board.
Step 6: Fix the 2 red LEDs in the bread board, then commonly connect the positive pins (+) together and negative pins (-) together.
Step 7: Take an Anode pin to digital pin 11 and Cathode to gnd.
Step 8: Fix the 2 blue LEDs in the bread board, and then connect the positive pins (+) together and negative pins (-) together.
Step 9: Take an Anode pin to digital pin 12 and Cathode to gnd.
Programming
  1. const int analogInPin = A0; // Analog input pin in potentiometer to be attached.
  2. int sensorvalue = 0;
  3. int timer = 0;
  4. void setup()
  5. {
  6. pinMode(12, OUTPUT);
  7. pinMode(11, OUTPUT);
  8. }
  9. void loop()
  10. {
  11. sensorValue = analog Read(analogInPin);
  12. timer = map(sensorValue, 0, 1023, 10, 500); //time delay.
  13. digitalWrite(12, HIGH);
  14. delay(timer);
  15. digitalWrite(12, LOW);
  16. delay(timer);
  17. digitalWrite(12, HIGH);
  18. delay(timer);
  19. digitalWrite(12, LOW);
  20. delay(timer);
  21. digitalWrite(11, HIGH);
  22. delay(timer);
  23. digitalWrite(11, LOW);
  24. delay(timer);
  25. digitalWrite(11, HIGH);
  26. delay(timer);
  27. digitalWrite(11, LOW);
  28. delay(timer);
  29. }
Figure 2: Police Strobe Light
Explanation
  • LEDs can blink lightly one by one automatically, we can adjust the potentiometer and see the changes in LEDs blink.
  • const int analogInPin = The input from the potentiometer to the Arduino board.
  • The strobe lights are used in Ambulance, Fire engine in Emergency situation.