user35062: Say I have 3 LEDs. I want LED1 to blink 5 times. At its third blink, LED2 should start blinking as well, also 5 times. While LED2 is at its 3rd blink, LED3 should start blinking. How do I do this in Arduino? 
Here's what I have.
int timeStep = 200; // delay time
int myPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; // array with Pins
int myPinsSize = sizeof(myPins) / sizeof(myPins[0]); // Length of my array
int counter = 0;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  for (int i = 0; i < myPinsSize; i++) {
    pinMode(myPins[i], OUTPUT);
  }
}

// the loop function runs over and over again forever
void loop() {
  LEDsequence();
  if(counter >= 9) {
    counter = 0;
  } else {
    counter++;
  }
}

void LEDsequence() {
  if(counter < 5) {
    switchOn(0);
  }
  if(counter >= 2 && counter < 7) {
    switchOn(1);
  }
  if(counter >=4 && counter < 9) {
    switchOn(2);
  }
  delay(timeStep);
  switchAllOff();
}

void switchOn(int index) {
  digitalWrite(myPins[index], HIGH);
}

void switchOff(int index) {
 digitalWrite(myPins[index], LOW);
}

void switchAllOff() {
  for (int i = 0; i < myPinsSize; i++) {
    digitalWrite(myPins[i], LOW);
  }
}


user24459: Building on Michel's answer (this is a bit long to put in a comment):
Rather than using a 2 dimensional array or an array of strings (which is also a 2d array) it would be far more efficient to use a bitmask system.
const uint8_t TIME_PERIODS = 20;
const uint8_t NR_LEDS = 3;
const uint8_t ledStates[] = [1,0,1,0,3,0,3,0,7,0,6,0,6,0,4,0,4,0,4,0];

and then the loop becomes:
  for (int period = 0; period < TIME_PERIODS; period++) 
  { 
    for (int led = 0; led < NR_LEDS; led++)
    {
      switch(led, ledStates[period] & 1<<led ); // set the led on or off
    }
    delay(500); // 0.5 s
  }

How this works:
1<<led will be 0001 in binary for led=0, 0010 for led = 1, 0100 for led = 2.
So if ledStates[period] was 3 (0011 in binary) then ledStates[period] & 1<<led will be non-zero for leds 0 and 1 and zero for led 2. The way the switch function is written any non zero value turns the LED on, 0 turns it off.
Why do it this way? Mainly size. Memory is always important, this uses 1 byte per state rather than 3. It could even be expanded to up to 8 LEDs without increasing the amount of memory used.

35062: <p>Say I have 3 LEDs. I want LED1 to blink 5 times. At its third blink, LED2 should start blinking as well, also 5 times. While LED2 is at its 3rd blink, LED3 should start blinking. How do I do this in Arduino? 
Here's what I have.</p>

<pre><code>int timeStep = 200; // delay time
int myPins[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; // array with Pins
int myPinsSize = sizeof(myPins) / sizeof(myPins[0]); // Length of my array
int counter = 0;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  for (int i = 0; i &lt; myPinsSize; i++) {
    pinMode(myPins[i], OUTPUT);
  }
}

// the loop function runs over and over again forever
void loop() {
  LEDsequence();
  if(counter &gt;= 9) {
    counter = 0;
  } else {
    counter++;
  }
}

void LEDsequence() {
  if(counter &lt; 5) {
    switchOn(0);
  }
  if(counter &gt;= 2 &amp;&amp; counter &lt; 7) {
    switchOn(1);
  }
  if(counter &gt;=4 &amp;&amp; counter &lt; 9) {
    switchOn(2);
  }
  delay(timeStep);
  switchAllOff();
}

void switchOn(int index) {
  digitalWrite(myPins[index], HIGH);
}

void switchOff(int index) {
 digitalWrite(myPins[index], LOW);
}

void switchAllOff() {
  for (int i = 0; i &lt; myPinsSize; i++) {
    digitalWrite(myPins[i], LOW);
  }
}
</code></pre>
 24459: <p>Building on Michel's answer (this is a bit long to put in a comment):</p>

<p>Rather than using a 2 dimensional array or an array of strings (which is also a 2d array) it would be far more efficient to use a bitmask system.</p>

<pre><code>const uint8_t TIME_PERIODS = 20;
const uint8_t NR_LEDS = 3;
const uint8_t ledStates[] = [1,0,1,0,3,0,3,0,7,0,6,0,6,0,4,0,4,0,4,0];
</code></pre>

<p>and then the loop becomes:</p>

<pre><code>  for (int period = 0; period &lt; TIME_PERIODS; period++) 
  { 
    for (int led = 0; led &lt; NR_LEDS; led++)
    {
      switch(led, ledStates[period] &amp; 1&lt;&lt;led ); // set the led on or off
    }
    delay(500); // 0.5 s
  }
</code></pre>

<p>How this works:<br>
<code>1&lt;&lt;led</code> will be 0001 in binary for led=0, 0010 for led = 1, 0100 for led = 2.<br>
So if <code>ledStates[period]</code> was 3 (0011 in binary) then <code>ledStates[period] &amp; 1&lt;&lt;led</code> will be non-zero for leds 0 and 1 and zero for led 2. The way the switch function is written any non zero value turns the LED on, 0 turns it off.<br></p>

<p>Why do it this way? Mainly size. Memory is always important, this uses 1 byte per state rather than 3. It could even be expanded to up to 8 LEDs without increasing the amount of memory used.</p>
