Arduino - control ten LED's with a delay timer and then some blink at the end.


I'm trying to create an Ardunio LED project which will light up 9 LED's one after each other but the process only starts after an initial 5 second delay.

So this is what I need:

All LED's are off to begin with. After 5 seconds, LED 1 will come on then a pause for 2 seconds then LED 2 will come on, pause for 2 seconds, LED 3 will come on, pause for 2 seconds and repeat this process until we reach LED 8

After 16 seconds:

LED 8 needs to come on and blink off and on for half a second (500ms) and this needs to continue blinking
LED 9 (at the same time as LED 8) needs to come on and blink off and on for 1.5 seconds (1500ms) and this needs to continue blinking

At this point LED's 8 and 9 will need to continue to blink off and on whilst LED's number 1 through 7 will need to stay constantly on.

I am trying to work out how best to do this using timers and its doing my head in!!

Can this be done using an Arduino as its quite a complex timing problem involving multiple LED's.

Anyone be kind enough to layout some basic code to help me??

Many Thanks!!

Of course it can be done.

But this is not a code writing service, as I'm sure you understand. If you want to pay for that, visit the "gigs" forum section. What we are more than happy to do is help, guide and coach you on your journey. You must make the first step.

From what you say, a simple sketch using delay() should surfice. But say now if you plan for the sketch to do any more than that. Even checking a button to see if it has been pressed counts as doing something else.

You need to use only 3 commands.

pinMode() to set each of the pins to OUTPUT in setup().

digitalWrite() to switch a led on/HIGH or off/LOW

delay() to pause.

The sequence for LEDs 1 to 7 occurs only once, so put that in setup().

The sequence for LEDs 8 & 9 repeats, so put that into loop(). The total of all the delays in loop() should be 3000ms. During that time, led 9 will flash on and off once and led 8 will flash on and off 3 times.

thanks for your help. it was for a personal hobby project so just trying to get my head around it.

You can also use millis() function for more flexibility and control.

My MultiBlink code may be suitable for your application. You will need to change the data table that drives the LED patterns to suit your needs. Find it at GitHub - MajicDesigns/MultiBlink: Blink LEDs in different configurable patterns