0Pricing
Arduino & IoT Academy · Lesson

delay() and Blink Timing

Pause execution to make a visible blink rhythm.

delay() and Blink Timing is a free Arduino & IoT Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Add a Pause

Switching a pin on and off happens in microseconds, far too fast to see. To make a real blink, you tell the board to wait with delay. ⏱️

delay Speaks Milliseconds

The delay function pauses your sketch for a number of milliseconds. One second is 1000 of them, so delay(1000) waits one full second.

delay(1000);

Freeze the Light On

Turn the LED HIGH, then call delay. The board sits still and the LED stays lit for the whole pause before doing anything else.

digitalWrite(ledPin, HIGH);
delay(1000);

Then Hold It Off

Now drive the pin LOW and delay again. The LED stays dark for that pause, giving the off half of your blink its own visible moment.

digitalWrite(ledPin, LOW);
delay(1000);

The Full Blink Loop

Stack those four lines inside loop() and you get a steady blink: on, wait, off, wait, repeat. That is the classic Blink sketch.

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

Faster or Slower

Change the number to change the rhythm. A smaller value like delay(200) makes a quick flash, while a larger one slows the blink right down.

delay(200);

On and Off Can Differ

The two delays do not have to match. A long on-time and short off-time gives a steady glow with a brief wink between pulses.

delay Stops Everything

Here is the catch: during a delay the board does nothing else. It cannot read a button or sensor, because delay blocks the whole sketch.

Fine for Now

For a simple blink, blocking is fine. Later you will meet millis, a way to time events without freezing the rest of your program.

Tiny vs Big Waits

delay handles milliseconds, but for very short pauses there is delayMicroseconds. You will need it later for precise sensor timing.

Loop Does the Repeating

You never write a repeat command. Because loop() runs again automatically, your on-off-wait pattern repeats forever on its own.

Quick Check

You want the LED to stay on for exactly two seconds.

Recap

You used delay to pace your blink, learned it counts milliseconds, and saw that it blocks everything else. Next you will wire a real LED. 🎉

Frequently asked questions

Is the “delay() and Blink Timing” lesson free?

Yes — the full text of “delay() and Blink Timing” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.

What will I learn in “delay() and Blink Timing”?

Pause execution to make a visible blink rhythm. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Arduino & IoT Academy?

No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “delay() and Blink Timing” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Arduino & IoT Academy lesson?

Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. pinMode and OUTPUT
  2. digitalWrite HIGH & LOW
  3. delay() and Blink Timing
  4. Wire an External LED Safely
← Back to Arduino & IoT Academy