if (previousMillisLed1 + delayArray[i] <= millis())
That’s not what BlinkWithoutDelay or Robin’s thread shows but it could work for almost 50 days with unsigned longs. What you want uses an unsigned subtraction that always returns the difference of two times even across rollovers.
if ( now - start_time >= interval ) // all those being unsigned integers, usually unsigned longs are used
// interval since start_time has passed, do what needs to be done
fprete, are you familiar with the Blink Without Delay example in your IDE?
Shpaget, I can link you to a better, more full yet still beginner-friendly explanation of the subject.
The subject of unsigned math is considered too hard for beginners but it’s at the heart of the time-difference equation and it does work the same right past rollover. Learn how that works and you will never forget how to compute time differences because it won’t be memorization but understanding behind your usage.
The simplest explanation involves how you can tell that 2 o’clock is 3 hours after 11 o’clock. Is that complicated? The clock is unsigned base-12, in computerese the 12 should be 0. Unsigned integers work the same just bigger.
Unsigned math also allows using unsigned 16 and even 8 bit variables to time shorter intervals. I’ve used bytes (unsigned 8 bit) to time button debounces and unsigned ints (16 bit) to time 1 minute or less intervals and they work just fine. If you want to get into it then we can but not in this thread.