Jolynn Awesome
Published © LGPL

Police Chaser Lights

Learn to flash Red and Blue LED's to resemble police Lights.

BeginnerShowcase (no instructions)1 hour22,187
Police Chaser Lights

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
LED (generic)
LED (generic)
×6
Resistor 221 ohm
Resistor 221 ohm
220 will work
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritzing Diagram

> All Resistors: 220 ohms
>Blue Wire Connected to ground on Arduino and breadboard
>Red Wires Connected to pins 13, 12, 11, 10, 9, 8 on Arduino and Positive LED leads
>Resistors connected to negative leads of LED as well as ground on breadboard

Code

Police Chaser Lights

Arduino
/*
Police Chaser Lights
Author: Jista Awesome
Date: December 2, 2016

This program flashes the middle red and blue LED and the LED directly to the left of 
each color. Then flashes the middle red and blue LED as well as the LED directly to the
Right of each color.
 */


// the setup function runs once when you press reset or power the board
void setup() {
  //                      RED LED's <   >BLUE LED's
  // initialize digital pin 13, 12, 11, 10, 9, 8 as an output.
  pinMode(13, OUTPUT);  //Left Red
  pinMode(12, OUTPUT);  //Middle Red
  pinMode(11, OUTPUT);  //Right Red
  pinMode(10, OUTPUT);  //Left Blue
  pinMode(9, OUTPUT);   //Middle Blue
  pinMode(8, OUTPUT);   //Right Blue
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   
  digitalWrite(12, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(9,  HIGH);
  delay(100);
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(10, LOW);
  digitalWrite(9, LOW);
  delay(100);
  /////LED Alternate sides/////
  digitalWrite(11, HIGH);   
  digitalWrite(12, HIGH);
  digitalWrite(8, HIGH);
  digitalWrite(9,  HIGH);
  delay(100);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  delay(100);
  
  


}

Credits

Jolynn Awesome

Jolynn Awesome

5 projects • 41 followers
I have a crazy obsession with ducks!

Comments