emergency vehicle lights

Hello to all of you Arduino users,

Let me start introducing myself. My name is Erwin (a.k.a. ambuman) and I'm from Holland.

Recently I celebrated my birthday and guess what...
They've bought daddy an Arduino (with a breadboard and wire kit)!!!
Well..
You know how that goes.
:wink:
Daddy searches the WWW...
Daddy orders his goodies...
After a propper inspection daddy passes the "secret box" that he got from the mail man to mommy...
Mommy wraps it up...
You figure out the rest, including the oohs and aahs...
;D

After playing around a bit with simple LED blinking speed and some Knight Rider fun I made up MyFirstArduinoProject Huh

Here it is:

Let me know what you think of it.
::slight_smile:

Regards,

Erwin.

Very nice. I love flashing lights. as long as they are not on the cop car behind me.

Cool!

Is the center LED supposed to light during that sequence?

Thanks for your responses! :slight_smile:

@ CodingBadly
Nope... I used the centre light in the Knight Rider program to test the stuff. In this program I left it out on purpose. It splits the two sides nicely.

Gr. Erwin.

Very nice! I was just thinking today of how simple the light bar in my car would be to make on an arduino and you've clearly shown how!

Looks like you've started on a new and long lasting hobby :wink:

I thought of interfacing to the electronincs in the car from work.
Probably that will make my boss go nuts... :o >:(
The lightbar on my car sucks bigtime...
;D

And the code? :slight_smile:

Oh well.. That wasn't so special.
Just an amazingly simple switch on and switching off with a few LED's.
:wink:
Here it is.

Erwin.

// Emergency

  int LED1 = 1;     // the number of LED pin 1
  int LED2 = 2;     // the number of LED pin 2
  int LED3 = 3;     // the number of LED pin 3
  int LED4 = 4;     // the number of LED pin 4
  int LED5 = 5;     // the number of LED pin 5
  int LED6 = 6;     // the number of LED pin 6
  int LED7 = 7;     // the number of LED pin 7
  

//Timers and counters
  int timing = 30;
  byte count1 = 1;
  byte count2 = 1;
  byte count3 = 1;
  byte count4 = 1;
  
  

void setup ()
{
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);
  pinMode(LED7, OUTPUT);
}


void loop ()
{
  // Code for blinking order
  do
  {
   digitalWrite(LED3, HIGH);   // set the LED on
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED2, HIGH);    // set the LED on
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED1, HIGH);   // set the LED on
   delay(timing);                  // wait for 'timing' millisec

   digitalWrite(LED3, LOW);    // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED5, HIGH);   // set the LED on
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED2, LOW);    // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED6, HIGH);   // set the LED on
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED1, LOW);    // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED7, HIGH);   // set the LED on
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED5, LOW);    // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   
   digitalWrite(LED5, LOW);   // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED6, LOW);    // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   digitalWrite(LED7, LOW);   // set the LED off
   delay(timing);                  // wait for 'timing' millisec
   
   count1++;
  }
 while(count1<=3);
 do
 {
   do
   {
     digitalWrite(LED1, HIGH);   // set the LED on
     digitalWrite(LED2, HIGH);   // set the LED on
     digitalWrite(LED3, HIGH);   // set the LED on
     delay(timing*3);                  // wait for 'timing'*3 millisec
 
     digitalWrite(LED1, LOW);   // set the LED off
     digitalWrite(LED2, LOW);   // set the LED off
     digitalWrite(LED3, LOW);   // set the LED off
     delay(timing*3);                  // wait for 'timing'*3 millisec
 
     count2++;
   }
 while(count2<=3);
 
  do
   {
     digitalWrite(LED5, HIGH);   // set the LED on
     digitalWrite(LED6, HIGH);   // set the LED on
     digitalWrite(LED7, HIGH);   // set the LED on
     delay(timing*3);                  // wait for 'timing'*3 millisec
 
     digitalWrite(LED5, LOW);   // set the LED off
     digitalWrite(LED6, LOW);   // set the LED off
     digitalWrite(LED7, LOW);   // set the LED off
     delay(timing*3);                  // wait for 'timing'*3 millisec
 
     count3++;
   }
   while(count3<=3);
   count4++;
 }
 while(count4<=3);
  
   count1=1;
   count2=1;
   count3=1;
   count4=1;
}

Next step is to port the project to a 3 pin usage :slight_smile:

Hmmm.... :o
I think I have to sleep on that for a few nights... :-/
;D

I did a similar project. Everyone loves police lights! Using super-bright blue and red LEDs really helps get the right effect. See Arduino Police Lights | Project Lab

There's a video, and the code is posted.

That's a nice one!
Bit more fancy coding than mine :o
I'm just a C/C++ newbie, but hey...
I'm learning in progress :smiley:
Thanks for posting!

E.