Millis blink Led question ?

Hi , i am having some trouble using the millis(). I understand it’s basic function and i want to use it as a Blinking Led once 5 seconds but i don’t want it to be 5 seconds HIGH and 5 LOW , more like once 5 seconds to blink (100ms HIGH , 5s LOW).
Here is the code:

const int Led = 9;   //Led 
unsigned long previousMillis2 = 0; // last time update
unsigned long interval2 = 5000;
unsigned long interval3 = 100;
unsigned long currentMillis;


void setup() {

  pinMode(Led, OUTPUT);
  digitalWrite(Led, LOW);

}

void loop() {

  currentMillis = millis();
  
  if ((currentMillis - previousMillis2) >= interval2) {    //Once 5 seconds
  
    previousMillis2 = currentMillis;
  
    if ((currentMillis - previousMillis2) < interval3) {    //Blink for 100ms once 5 seconds 
      digitalWrite(Led, HIGH);
    }
  
    else {
      digitalWrite(Led, LOW);

    }
  }
}

It just keeps the Led HIGH all the time.

Why is interval3 set to 000 ?

I assume you wanted to switch on an LED for 100ms and then wait for 5sec, then continue the cycle.

I wrote a small library to do that, check one of my post.

If you want 5 seconds LOW then 100 milliseconds HIGH, simply modify the BlinkWithoutDelay program and change the timing interval appropriately each time you change the state of the LED.

When you set the state to HIGH set the period to 100 and when you set the state to LOW set the interval to 5000.

vaj4088:
Why is interval3 set to 000 ?

My bad, it was 100.
Thanks, I made it work somehow. :o

The demo Several Things at a Time is an extended example of BWoD and may hep with understanding.

...R

Thanks, I made it work somehow. :o

Would you care to share your working program ?