# random blinking without delay and blinking with delay in 1

**URL:** <https://forum.arduino.cc/t/random-blinking-without-delay-and-blinking-with-delay-in-1/522967>\
**Category:** Programming\
**Created:** [April 27, 2018, 10:20pm UTC](https://forum.arduino.cc/t/random-blinking-without-delay-and-blinking-with-delay-in-1/522967 "2018-04-27T22:20:06Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [April 28, 2018, 11:17am UTC](https://forum.arduino.cc/t/random-blinking-without-delay-and-blinking-with-delay-in-1/522967/7 "2018-04-28T11:17:07Z")

</div>

As you said

> here are many ways to blink three times and then wait some time using millis().

Here is another one that gives complete control over the intervals

```arduino
const long periods[] = {100, 100, 100, 100, 100, 100, 1000, 0};
byte index;
unsigned long startTime;
unsigned long currentTime;
const byte ledPin = 13;

void setup()
{
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);
}

void loop()
{
  currentTime = millis();
  if (currentTime - startTime >= periods[index])
  {
    digitalWrite(ledPin, !digitalRead(ledPin));
    index = ++index % 8;
    startTime = currentTime;
  }
}

```

---

_[View the full topic](https://forum.arduino.cc/t/random-blinking-without-delay-and-blinking-with-delay-in-1/522967)._
