Blink 6 leds without delay!


Can you give me some ideas how to write a program for blinking 6 leds without delay?
My leds pins are: 4,5,6, 8,9,10.

Thank you in advance!

Set an unsigned long variable for each of the leds and another for the present ‘time’. In the main loop update the time variable with millis(). Then have a series of if/then constructs (one for each led) that sets the next time you want the led to be actioned and then set it on or off. A boolean for each led would be handy to know if the led was last on or off.

Heres a lump of one of my sketches.

if (time >= loop1 ){ 
    loop1 = time + 200;

    if (led1){ 
      digitalWrite(powerled, HIGH); 
      led1 = false; 
      digitalWrite(powerled, LOW); 
      led1 = true;

Time is set to millis , then you have 6 lots of the above with seperate loopx (unsigned long) and ledx(boolean) for each. You adjust the 200 value to suit each led period (200 milliseconds = 0.2 seconds.