Blink led without blink led sketch for Arduino.
To turn an LED on or off we often use the blink sketch.
The disadvantage is that you have to make a delay in your sketch at least twice.
That is often not desirable. The processor does nothing during a delay.
The "wait without delay" sketch is cumbersome and takes up a lot of memory space if it is often used.
The solution that I often use for this is a self-blinking LED.
In the example diagram you see two LEDs as if they were anti-parallel.
The green LED gives a "safe" indication. And the red indicator Led indicates an "unsafe" indication.
If D3 is low, the green LED will go on. If D3 is high, the red LED will flash.
The delay in the demo sketch is also only meant as a demo. Can be omitted in a "true" or "false" sketch.
Parts and schematic.
Demo Sketch ( Arduino).