user81387: Good evening,
I am writing Arduino code to flash multiple LEDS at different sequences from different pins. Everything is working well, however I cant determine how to add in a Morse Code A flash sequence.
Ideally the sequence would go 1s, on 1s off, 3s on, 3s off. then repeat continuously, this would be for a MO (A) bouy
Below is the format I have used for all other lights and works well with 8 different sequences.
// A is 1s, B is 2.5s, C is 4s, D is 5s, F is 6s, G is 8s, H is 10s , 

#define aLed 2
#define bLed 3
#define cLed 4
#define dLed 5
#define fLed 6
#define gLed 7
#define hLed 8


void setup() {
  pinMode(aLed, OUTPUT); //pin2 Output
  pinMode(bLed, OUTPUT); //pin3 Output
  pinMode(cLed, OUTPUT); //pin4 Output
  pinMode(dLed, OUTPUT); //pin5 Output
  pinMode(fLed, OUTPUT); //pin6 Output
  pinMode(gLed, OUTPUT); //pin7 Output
  pinMode(hLed, OUTPUT); //pin8 Output
 

}

void loop() {
  BlinkA(1000);
  BlinkB(2500);
  BlinkC(4000); 
  BlinkD(5000);
  BlinkF(6000);
  BlinkG(8000);
  BlinkH(10000);
 
}
 void BlinkA (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(aLed, !digitalRead(aLed));
 } 
}
void BlinkB (int interval){
   static long prevMill = 0;
   if (((long)millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(bLed, !digitalRead(bLed));
  }
 }
  void BlinkC (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(cLed, !digitalRead(cLed));
 } 
}
 void BlinkD (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(dLed, !digitalRead(dLed));
 } 
}
 void BlinkF (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(fLed, !digitalRead(fLed));
 } 
}
 void BlinkG (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(gLed, !digitalRead(gLed));
 } 
}
 void BlinkH (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) >= interval){ 
    prevMill = millis(); 
    digitalWrite(hLed, !digitalRead(hLed));
 } 
}



user20245: 
multiple blinking LEDs at different intervals, (not all periodic)...

I changed your question hopefully with out changing its meaning.
Based on this question, I would suggest using a finite state machine.  Assuming you are using differently named "BlankI()" functions for each LED, consider adding state machine features to 1 of these functions to control the "not periodic" LED.  Consider a state machine with 4 state one for each action:

LED On for 1 second.
LED Off for 1 second.
LED On for 3 seconds.
LED Off for 3 seconds.

Use a counter (either global or static to preserve its value between calls to that function) to track the states.  Use a switch/case coding pattern to set the "prevMill" to the appropriate time delay for the current state.

81387: <p>Good evening,</p>
<p>I am writing Arduino code to flash multiple LEDS at different sequences from different pins. Everything is working well, however I cant determine how to add in a Morse Code A flash sequence.</p>
<p>Ideally the sequence would go 1s, on 1s off, 3s on, 3s off. then repeat continuously, this would be for a MO (A) bouy</p>
<p>Below is the format I have used for all other lights and works well with 8 different sequences.</p>
<pre class="lang-cpp prettyprint-override"><code>// A is 1s, B is 2.5s, C is 4s, D is 5s, F is 6s, G is 8s, H is 10s , 

#define aLed 2
#define bLed 3
#define cLed 4
#define dLed 5
#define fLed 6
#define gLed 7
#define hLed 8


void setup() {
  pinMode(aLed, OUTPUT); //pin2 Output
  pinMode(bLed, OUTPUT); //pin3 Output
  pinMode(cLed, OUTPUT); //pin4 Output
  pinMode(dLed, OUTPUT); //pin5 Output
  pinMode(fLed, OUTPUT); //pin6 Output
  pinMode(gLed, OUTPUT); //pin7 Output
  pinMode(hLed, OUTPUT); //pin8 Output
 

}

void loop() {
  BlinkA(1000);
  BlinkB(2500);
  BlinkC(4000); 
  BlinkD(5000);
  BlinkF(6000);
  BlinkG(8000);
  BlinkH(10000);
 
}
 void BlinkA (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(aLed, !digitalRead(aLed));
 } 
}
void BlinkB (int interval){
   static long prevMill = 0;
   if (((long)millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(bLed, !digitalRead(bLed));
  }
 }
  void BlinkC (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(cLed, !digitalRead(cLed));
 } 
}
 void BlinkD (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(dLed, !digitalRead(dLed));
 } 
}
 void BlinkF (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(fLed, !digitalRead(fLed));
 } 
}
 void BlinkG (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(gLed, !digitalRead(gLed));
 } 
}
 void BlinkH (int interval){
   static long prevMill = 0;
   if ((millis() - prevMill) &gt;= interval){ 
    prevMill = millis(); 
    digitalWrite(hLed, !digitalRead(hLed));
 } 
}

</code></pre>
 20245: <blockquote>
<p>multiple blinking LEDs at different intervals, (<em>not all periodic</em>)...</p>
</blockquote>
<p>I changed your question hopefully with out changing its meaning.</p>
<p>Based on this question, I would suggest using a <a href="https://en.wikipedia.org/wiki/Finite-state_machine" rel="nofollow noreferrer">finite state machine</a>.  Assuming you are using differently named &quot;BlankI()&quot; functions for each LED, consider adding state machine features to 1 of these functions to control the &quot;<em>not periodic</em>&quot; LED.  Consider a state machine with 4 state one for each action:</p>
<ol start="0">
<li>LED On for 1 second.</li>
<li>LED Off for 1 second.</li>
<li>LED On for 3 seconds.</li>
<li>LED Off for 3 seconds.</li>
</ol>
<p>Use a counter (either global or static to preserve its value between calls to that function) to track the states.  Use a <a href="https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/" rel="nofollow noreferrer">switch/case</a> coding pattern to set the &quot;prevMill&quot; to the appropriate time delay for the current state.</p>
