Arduino Police Strobe Light Code




Arduino Police Strobe Light effect, another simple variation of blink code.

Arduino Police Strobe Light




Instruction;
1) Connect all LED as diagram below, make sure cathode lead of LED at ground wire.

2) Connect all 330Ω resistor to anode lead of LED.

3) Connect all jumper wire to digital pin 12 and 11.

4) Connect 10kΩ potentiometer as shown and center lead connect to analog 0 pin.

Upload this code to your arduinoArduino Police Strobe Light

/*
  Police Strobe Light
  Create police strobe light effect with speed control of the blink.

  Coded by: arduinoprojects101.com
 */
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0;        // value read from the pot
int timer = 0;              // delay value

void setup() {
  // initialize the digital pin 12, 11 as an output.
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map sensorValue reading to match timer delay between 10ms to 500ms
  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);
  digitalWrite(11, HIGH);
  delay(timer);
  digitalWrite(11, LOW);
  delay(timer);
  digitalWrite(11, HIGH);
  delay(timer);
  digitalWrite(11, LOW);
}

This arduino projects, is another variation of blink code. delay value controlled by timer constant.

Major Components in Project

Parts List;
1) 2x 5mm red LED
2) 2x 5mm blue LED
3) 1x Arduino
4) 4x 330Ω resistor
5) 1x 10kΩ potentiometer
6) Jumper wire

For more detail: Arduino Police Strobe Light Code




This Post / Project can also be found using search terms:

  • arduino strobe light
  • arduino uno police lights
  • arduino police
  • arduino Police light ckt &code
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Arduino RFID Lock
Arduino RFID Lock

The Arduino RFID lock How does it work? The Arduino RFID lock is a lock that can be opened easily,...

Close
Scroll to top