# Blink without delay, two intervals 240615

**URL:** <https://forum.arduino.cc/t/blink-without-delay-two-intervals-240615/1272215>\
**Category:** Programming\
**Created:** [June 15, 2024, 9:26pm UTC](https://forum.arduino.cc/t/blink-without-delay-two-intervals-240615/1272215 "2024-06-15T21:26:37Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [June 17, 2024, 6:50pm UTC](https://forum.arduino.cc/t/blink-without-delay-two-intervals-240615/1272215/23 "2024-06-17T18:50:44Z")

</div>

> [@AllenPitts](#):
>
> - So is there a way of writing the code without an array?

For inspiration, maybe take a look at the several different ways of doing Blink Without Delay with multiple LEDs in:

> [@Flashing 2 or more LEDs at the same time](https://forum.arduino.cc/t/flashing-2-or-more-leds-at-the-same-time/1063833):
>
> Introduction A common question is to ask how to flash 2 (or more) LEDs at the same time. Typically the person asking will be using delay and will be experiencing the main problem with delay: it blocks and stops anything else from happening. The code below flashes 2 LEDs, one connected to pin 2 and one to Pin 3, each with a suitable resistor (220 Ohms or thereabouts) to 0V. Each LED flashes independently of the other. Notes I have used separate functions called from the loop function to illus…

Oops. I meant:

> [@Flashing multiple LEDs at the same time](https://forum.arduino.cc/t/flashing-multiple-leds-at-the-same-time/1065564):
>
> Introduction A common question is to ask how to flash 2 (or more) LEDs at the same time. Typically the person asking will be using delay and will be experiencing the main problem with delay: it blocks and stops anything else from happening. This tutorial contains several different approaches to the problem of flashing 2 or more LEDs at the same time with independent timing for each LED. The basic principles for each can all be adapted for other situations requiring multiple timers working inde…

The intervals are different because of this intervals[] array:

> [@AllenPitts](#):
>
> ```arduino
> const long intervalOn = 2000;
> const long intervalOff = 250;
> const unsigned long intervals[] {intervalOff, intervalOn};
> 
> ```

That sets intervals[LOW] = 250 and intervals[HIGH] = 2000, through taking advantage of some extra knowledge that `LOW = 0 = false` and `HIGH = 1 = true`.

---

_[View the full topic](https://forum.arduino.cc/t/blink-without-delay-two-intervals-240615/1272215)._
