Go Down

Topic: emergency vehicle lights (Read 2015 times) previous topic - next topic

ambuman

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.
;)
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:
http://www.youtube.com/watch?v=7a-np_G_1yY

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

Regards,

Erwin.

PaulS

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

Coding Badly

Cool!

Is the center LED supposed to light during that sequence?

ambuman

Thanks for your responses! :)

@ 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.

Limb

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  ;)

ambuman

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

Federico

Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

ambuman

#7
Jan 08, 2010, 03:57 pm Last Edit: Jan 08, 2010, 07:27 pm by ambuman Reason: 1
Oh well.. That wasn't so special.
Just an amazingly simple switch on and switching off with a few LED's.
;)
Here it is.

Erwin.

Code: [Select]

// 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;
}

Federico

Next step is to port the project to a 3 pin usage :)
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

ambuman

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

nootropic

I did a similar project.  Everyone loves police lights!  Using super-bright blue and red LEDs really helps get the right effect.  See http://nootropicdesign.com/projectlab/2010/01/08/arduino-police-lights/

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


ambuman

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  :D
Thanks for posting!

E.

Go Up