Project showcase
Police Chaser Lights

Police Chaser Lights © LGPL

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

  • 6,724 views
  • 0 comments
  • 20 respects

Components and supplies

Apps and online services

About this project

A small project that beginners can try on their own if you need something cool to practice your Arduino and coding skills.

Police Chaser Lights

Code

Police Chaser LightsArduino
/*
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);
  
  


}

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
7pohksnm5jowwl7l6pgq

Comments

Similar projects you might like

Musical Fairy Lights

Project tutorial by Ian Cumming

  • 4,507 views
  • 0 comments
  • 11 respects

Railroad Crossing Lights

Project showcase by eldo85

  • 3,346 views
  • 4 comments
  • 7 respects

Arduino Bike Blink Lights

Project showcase by Sam

  • 4,069 views
  • 3 comments
  • 13 respects

Fade Lights and Push Button

Project tutorial by Phuong Vo

  • 1,639 views
  • 2 comments
  • 7 respects

How to Configure NeoPixels Using Vixen Lights and Arduino

Project tutorial by Victor Aguilar

  • 13,209 views
  • 23 comments
  • 28 respects
Add projectSign up / Login