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 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 bread board, then commonly connect the postive 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 bread board, and then connect the postive pins (+) together and negative pins (-) together.
Step 9: Take an Anode pin to digital pin 12 and Cathode to gnd.
Programming
- const int analogInPin = A0;
- int sensorvalue = 0;
- int timer = 0;
- void setup()
- {
- pinMode(12, OUTPUT);
- pinMode(11, OUTPUT);
- }
- void loop()
- {
- sensorValue = analog Read(analogInPin);
- timer = map(sensorValue, 0, 1023, 10, 500);
- digitalWrite(12, HIGH);
- delay(timer);
- digitalWrite(12, LOW);
- delay(timer);
- digitalWrite(12, HIGH);
- delay(timer);
- digitalWrite(12, LOW);
- delay(timer);
- digitalWrite(11, HIGH);
- delay(timer);
- digitalWrite(11, LOW);
- delay(timer);
- digitalWrite(11, HIGH);
- delay(timer);
- digitalWrite(11, LOW);
- delay(timer);
- }
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 Arduino board.
- The strobe lights are used in Ambulance, Fire engine in Emergency situation.