user26416: I'm new to Arduino. For my first project,  I want to make aviation strobe lights. My challenge is to use ONE Arduino to blink both sets of lights. My issue is,  I DON'T want them to be synchronized. I saved a sketch of the blink example from the Arduino IDE software after editing it to do what I want. But, the LED's are synchronized. One LED strobes twice,  while the other strobes once as I want them to. However, they begin their loops together currently and stay synchronized,  which isn't what I want. 
So my question is: What is the code I need to write to make each LED blink unsynchronized from the other without having to use 2 Arduino units? 
Code:
int led = 11;
int led2 = 12;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);
  delay(50);
  digitalWrite(led, LOW);
  delay(1000);
  digitalWrite(led2,  HIGH);
  delay(50)
  digitalWrite(led2, LOW);
  delay(100) ;
  digitalWrite(led2,  HIGH);
  delay(50)
  digitalWrite(led2, LOW);
  delay(1000);
}


user23788: The Arduino Blink example uses delay() to pause the Arduino in a specific state, so that for a specific amount of milliseconds the device will keep the blinkPin HIGH or LOW.
Instead of using a delay(), you should use millis(). The main advantage of millis() over delay() is that it does not interrupt the code. When you call a delay() the whole code pauses, nothing can be done during those milliseconds. But millis() doesn't work that way. You also don't call it the same way as delay().
What millis() does is that it stores a timer value into an unsigned long. At a later point in time you can substract a new millis() from your previously stored millis in the unsigned long. The result is a difference in time between each millis() in milliseconds.
Now, instead of using only one unsigned long, we use two different ones: one for each LED. Now you can log a time interval, independently, for each LED. Furthermore, if you apply the logic of millis() for keeping the LEDs on or off, you don't have to interrupt the code with delay() functions. This means, that regardless of each LEDs state (HIGH or LOW), the timer keeps running, keeps logging and thus can control both LEDs simultaneously.
To give you a bit more information on millis(), below are some references that will get you started in how to implement. If you have more questions, just comment on this answer :)

millis() reference on the Arduino website
Blink without Delay example


26416: <p>I'm new to Arduino. For my first project,  I want to make aviation strobe lights. My challenge is to use ONE Arduino to blink both sets of lights. My issue is,  I DON'T want them to be synchronized. I saved a sketch of the blink example from the Arduino IDE software after editing it to do what I want. But, the LED's are synchronized. One LED strobes twice,  while the other strobes once as I want them to. However, they begin their loops together currently and stay synchronized,  which isn't what I want. </p>

<p>So my question is: What is the code I need to write to make each LED blink unsynchronized from the other without having to use 2 Arduino units? </p>

<p>Code:</p>

<pre><code>int led = 11;
int led2 = 12;

void setup() {
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
}

void loop() {
  digitalWrite(led, HIGH);
  delay(50);
  digitalWrite(led, LOW);
  delay(1000);
  digitalWrite(led2,  HIGH);
  delay(50)
  digitalWrite(led2, LOW);
  delay(100) ;
  digitalWrite(led2,  HIGH);
  delay(50)
  digitalWrite(led2, LOW);
  delay(1000);
}
</code></pre>
 23788: <p>The Arduino Blink example uses <code>delay()</code> to pause the Arduino in a specific state, so that for a specific amount of milliseconds the device will keep the <code>blinkPin</code> <code>HIGH</code> or <code>LOW</code>.</p>

<p>Instead of using a <code>delay()</code>, you should use <code>millis()</code>. The main advantage of <code>millis()</code> over <code>delay()</code> is that it <em>does not</em> interrupt the code. When you call a <code>delay()</code> the whole code pauses, nothing can be done during those milliseconds. But <code>millis()</code> doesn't work that way. You also don't call it the same way as <code>delay()</code>.</p>

<p>What <code>millis()</code> does is that it stores a timer value into an <code>unsigned long</code>. At a later point in time you can substract a new <code>millis()</code> from your previously stored <code>millis</code> in the <code>unsigned long</code>. The result is a difference in time between each <code>millis()</code> in milliseconds.</p>

<p>Now, instead of using only one <code>unsigned long</code>, we use two different ones: one for each LED. Now you can log a time interval, independently, for each LED. Furthermore, if you apply the logic of <code>millis()</code> for keeping the LEDs on or off, you don't have to interrupt the code with <code>delay()</code> functions. This means, that regardless of each LEDs state (<code>HIGH</code> or <code>LOW</code>), the timer keeps running, keeps logging and thus can control both LEDs simultaneously.</p>

<p>To give you a bit more information on <code>millis()</code>, below are some references that will get you started in how to implement. If you have more questions, just comment on this answer :)</p>

<ul>
<li><a href="https://www.arduino.cc/en/Reference/Millis" rel="nofollow"><code>millis()</code> reference on the Arduino website</a></li>
<li><a href="https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay" rel="nofollow">Blink without Delay example</a></li>
</ul>
