Blinking two LEDs in and out of phase

It's doing what you are telling it to do. Every few microseconds it changes the pattern. Perhaps you want to stay in one pattern for 'a while'. You could toggle between the two patterns every minute:

void loop() 
{
  static unsigned long timer = 0;

  // Two minute cycles
  if (millis() - timer >= 120000ul)
    timer = millis();
 
  if (millis() - timer < 60000ul)
    blink(50,0,2000);  // Even minutes
  else
    blink(50,100,3000); // Odd minutes
}
1 Like