LED COP LIGHTS USING ARDUINO!
Here's a video showing cop lights in action.
Downloads
Components Required
- Micro controller(I used arduino Uno)
- Breadboard
- Red LED's(Or any colour you like)
- Blue LED's
- Connecting wires
Thats all
Now lets start working :)
Making the Connections
Here is a circuit diagram,its not necessary to explain this its self explanatory
The pin 11 of arduino is connected to the positive terminal of the Blue LED
pin 9 is connected to the positive terminal of Red LED
the grounds are kept common and are connected to the GND pin
Uploading the Code
Here's the code you need to upload on the arduino
int ledDelay = 50; // delay by 50ms
int redPin = 9;
int bluePin = 11;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop()
{
digitalWrite(redPin, HIGH); // turn the red light on
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, LOW); // turn the red light off
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, HIGH); // turn the red light on
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, LOW); // turn the red light off
delay(ledDelay); // wait 50 ms
digitalWrite(redPin, HIGH); // turn the red light on
delay(ledDelay); // wait 50 ms
digitalWrite(redPin,LOW); // turn the red light off
delay(ledDelay); // wait 50 ms
delay(100); // delay midpoint by 100ms
digitalWrite(bluePin, HIGH); // turn the blue light on
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, LOW); // turn the blue light off
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, HIGH); // turn the blue light on
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, LOW); // turn the blue light off
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, HIGH); // turn the blue light on
delay(ledDelay); // wait 50 ms
digitalWrite(bluePin, LOW); // turn the blue light off
delay(ledDelay); // wait 50 ms
}
Downloads
You Are Done!
Yes you are done enjoy!