Skip to main content

Gradually Slowing LED Blink (Tired LED) - Beginner Tutorial

Learn how to make an LED blink rapidly at first and gradually slow down using Arduino.

In our first Arduino project, Blink an LED, we learned how to turn an LED ON and OFF using digitalWrite() and control the timing with delay().

In our second project, Fade an LED, we learned how to use PWM to gradually change an LED's brightness.

Now, in this project, we are going to use another simple programming concept: 

changing the timing of a program while it is running.

In this project, the LED will initially blink quickly. After each blink, the waiting time will gradually increase, causing the LED to blink more slowly - as though the LED is becoming tired.

What You Will Learn

After completing this project, you will understand:
  • How to control an LED's blinking speed.
  • How delay() controls the timing of an Arduino program.
  • How a variable can store a changing delay value.
  • How to increase a variable during program execution.
  • How the same LED circuit can be controlled using different programming techniques.
  • The difference between controlling LED brightness and controlling LED timing.

Supplies

The hardware components are the same as those used in Blink an LED Arduino Project.

You will need:
  • Arduino Uno R3
  • 1 × LED
  • 1 × 220 Ω resistor
  • Solderless breadboard
  • Jumper wires
  • USB cable
  • Computer with the Arduino IDE

Setting Up Your Hardware

The hardware connection for this project is the same as the Blink LED project.

Connect the components as follows:
  • Arduino D9 (~) → 220 Ω resistor
  • 220 Ω resistor → LED Anode (+)
  • LED Cathode (-) → Arduino GND

The complete connection is:

D9 → 220 Ω resistor → LED anode → LED cathode → GND

LED Polarity

Remember that an LED has polarity.

For a typical through-hole LED:
  • Longer leg → Anode (+)
  • Shorter leg → Cathode (−)
  • Flat edge of the LED body → Usually indicates the cathode
The 220 Ω resistor is connected in series with the LED to limit the current.

Important: Unlike the previous Fade an LED project, this project does not require a PWM-capable pin. We are controlling the timing of the LED rather than its brightness, so D9 is simply being used as a digital output.

What Is a "Tired LED"?

So, what do I mean by a Tired LED?

The idea is simple: the LED starts by blinking quickly, but the blinking gradually becomes slower.

We achieve this by increasing the amount of time the Arduino waits between turning the LED ON and OFF.

For example:

Short delay
↓
Fast blinking
↓
Increase delay
↓
Slower blinking
↓
Increase delay
↓
Even slower blinking

It is similar to a person who starts running quickly but gradually slows down as they become tired.

How Does It Work?

In the Blink project, we used:

digitalWrite()

to turn the LED ON and OFF, and:

delay()

to control how long the Arduino waits.

We will use the same basic concepts here.

The difference is that instead of keeping the delay constant, we will store it in a variable and increase that variable while the program is running.

For example:

100 ms → 200 ms → 300 ms → 400 ms → 500 ms → ...

As the delay becomes longer, the LED blinks more slowly.

Coding

Unlike the Fade project, we do not need PWM for this effect.

We will use:
  • digitalWrite() to turn the LED ON and OFF.
  • delay() to control how long the program waits.
  • A variable to store and increase the delay time.

Complete Code

const int ledPin = 9; 
int blinkDelay = 100; 

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

void loop() { 
digitalWrite(ledPin, HIGH); 
delay(blinkDelay); 
digitalWrite(ledPin, LOW); 
delay(blinkDelay); 
blinkDelay = blinkDelay + 100; 
if (blinkDelay > 2000) { 
blinkDelay = 100; 
}
}

Understanding the Code

Let's look at the program step by step.

1. Defining the LED Pin

const int ledPin = 9;

This tells the Arduino that the LED is connected to digital pin D9.
The name ledPin makes the code easier to understand.

2. Creating the Delay Variable

int blinkDelay = 100;

The variable blinkDelay stores the amount of time the Arduino will wait between changes in the LED's state.
The initial value is:

100 milliseconds

This means the LED begins blinking relatively quickly.

3. Configuring the LED Pin

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

The setup() function runs once when the Arduino starts or resets.
The pinMode() function configures D9 as an output so that the Arduino can control the LED.

4. Turning the LED ON

digitalWrite(ledPin, HIGH);

This sets the LED pin to HIGH, turning the LED ON.

The program then waits:

delay(blinkDelay);

At the beginning of the program, blinkDelay is 100, so the Arduino waits approximately 100 milliseconds.

5. Turning the LED OFF

digitalWrite(ledPin, LOW);

This turns the LED OFF.

The program waits for the same amount of time:

delay(blinkDelay);

The LED therefore starts with a short ON period and a short OFF period.

6. Increasing the Delay

This is the key part of the project:

blinkDelay = blinkDelay + 100;

Each time the LED completes one ON/OFF cycle, the program increases blinkDelay by 100 milliseconds.

The sequence becomes:
100 ms 
200 ms 
300 ms 
400 ms 
500 ms 
...

As the delay increases, the LED blinks more slowly.

7. Resetting the Cycle

Eventually, the delay reaches two seconds.

The following code prevents the delay from continuing to increase indefinitely:

if (blinkDelay > 2000) { 
blinkDelay = 100; 
}

When blinkDelay becomes greater than 2000 milliseconds, the program resets it to 100 milliseconds.
The LED therefore becomes fast again and starts another "tired" cycle.

How the Program Works

The overall process is:
Start 
↓ 
blinkDelay = 100 ms 
↓ 
LED ON 
↓ 
Wait 
↓ 
LED OFF 
↓ 
Wait 
↓ 
Increase blinkDelay by 100 ms 
↓ 
Repeat 
↓ 
Delay reaches 2000 ms 
↓ 
Reset delay to 100 ms 
↓ 
Start again

Here is a video showing how the program works:

Uploading the Program

After entering the code into the Arduino IDE:
  • Connect your Arduino Uno R3 to your computer.
  • Select the correct board.
  • Select the correct port.
  • Click Verify to compile the sketch.
  • If there are no errors, click Upload.
  • Wait for the upload to complete.
  • Observe the LED connected to D9.

Expected Result

After the program has been uploaded, the LED should initially blink rapidly.

The blinking should then gradually become slower as the delay increases.

After reaching the maximum delay, the program resets the delay and the LED starts blinking rapidly again.

The complete pattern is:

Fast → Gradually slower → Slowest → Reset → Fast → Repeat

Experiment 1: Make the LED Tire More Quickly

Try changing:

blinkDelay = blinkDelay + 100;

to:

blinkDelay = blinkDelay + 200;

The delay will increase more quickly, so the LED will become "tired" faster.

Experiment 2: Make the LED Tire More Slowly

Try changing:

blinkDelay = blinkDelay + 100;

to:

blinkDelay = blinkDelay + 25;

The delay will increase more gradually.

Observe how this changes the effect.

Experiment 3: Change the Maximum Delay

The program currently contains:

if (blinkDelay > 2000) { 
blinkDelay = 100; 
}

Try changing 2000 to: 5000

The LED will take much longer to reach its slowest blinking speed.

Challenge

Can you modify the program so that the LED:
  • Starts blinking quickly.
  • Gradually slows down.
  • Remains stopped for two seconds.
  • Starts blinking quickly again.
  • Repeats the entire sequence.
Try to solve the challenge yourself before searching for a solution.

Troubleshooting

The LED does not blink

Check:
  • The LED polarity.
  • The connection between D9 and the resistor.
  • The connection between the LED cathode and GND.
  • The USB connection.
  • The selected Arduino board.
  • The selected port.
  • Whether the sketch uploaded successfully.

The LED stays ON

Check that your program contains:

digitalWrite(ledPin, LOW);

and that the LED is connected correctly.

The LED blinks but does not slow down

Make sure the program contains:

blinkDelay = blinkDelay + 100;

and that blinkDelay is being used in both delay() statements.

What You Learned

In this project, you learned how a variable can be used to control the timing of an Arduino program.

You learned:
  • How digitalWrite() controls the LED.
  • How delay() controls timing.
  • How a variable can store a changing delay value.
  • How to increase a variable during program execution.
  • How an if statement can reset a variable.
  • How changing timing can create different physical effects.
You also learned that LED brightness and LED blinking speed are two different concepts.

In the previous project, we changed the LED's apparent brightness using PWM.

In this project, we change the time interval between LED states.

Going Further

The program in this project uses delay() because it is simple and easy to understand for beginners.
However, delay() pauses the execution of the program while it waits. In larger Arduino projects, you may want the Arduino to perform other tasks while keeping track of time.
A useful next step is learning how to use the millis() function to create timing without blocking the rest of the program.
This technique becomes especially useful when working with sensors, buttons, motors, displays, and multiple LEDs.

Conclusion

In this project, we created a simple Tired LED effect.
The LED begins by blinking quickly and gradually slows down as the program increases the delay between its ON and OFF states. Once the maximum delay is reached, the program resets the delay and starts the cycle again.
Although the project is simple, it introduces an important programming concept:
A variable can be changed while a program is running to control the behavior of physical hardware.
This concept will become increasingly useful as we move toward more advanced Arduino projects.

What's Next?

We've now learned how to control an LED's:
  • State - Blink an LED
  • Brightness - Fade an LED
  • Timing - Tired LED
In the next project, we'll introduce an input and make the Arduino respond to the physical world.

Follow RRRTechSolv for more Arduino, electronics, robotics, and embedded-systems projects.

Comments

Popular posts from this blog

Arduino Serial Communication Beginner Guide (UART Explained)

Serial communication is the backbone of most Arduino projects. It allows your Arduino to talk to your computer, Bluetooth modules, Wi-Fi modules, sensors, and even other Arduinos. If you have ever used the Serial Monitor, you have already used serial communication - now you will understand how it really works. By the end of this guide, you will learn: What serial communication is What UART means How Arduino communicates with devices How to send and receive data How baud rate works Common mistakes beginners make What is Serial Communication? Serial communication is a method of sending data one bit at a time over a single wire. Instead of sending many bits simultaneously (parallel communication), serial sends bits sequentially: Example: The letter A in binary = 01000001 These bits are sent one after another very quickly. This method is: Simple Reliable Perfect for microcontrollers What is UART? UART stands for: Universal Asynchronous Receiver Transmitter It is the hardware ins...

How to Connect HC-06 Bluetooth Module with Arduino (Step-by-Step Beginner Guide)

Bluetooth communication is one of the easiest ways to make Arduino projects wireless. Once you understand how to use a Bluetooth module, you can build robots, home automation systems, and smartphone-controlled devices. In this tutorial, you will learn how to interface the HC-06 Bluetooth module with Arduino and send data wirelessly using your phone.    By the end of this guide, you will be able to: Understand how the HC-06 Bluetooth module works Configure the module using AT commands Safely connect it to an Arduino Send and receive serial data over Bluetooth Build the foundation for wireless Arduino projects Watch the Project Overview What is the HC-06 Bluetooth Module? The HC-06 is a Bluetooth-to-Serial module designed to add wireless communication to microcontrollers such as Arduino. It uses Bluetooth 2.0 (SPP - Serial Port Protocol), which means it behaves like a wireless serial cable. Whatever is sent from the phone appears in Arduino’s Serial Monitor and vice versa. ...

How to Use SoftwareSerial on Arduino (Connect Multiple Serial Devices)

In the previous tutorial, you learned how Arduino uses hardware serial communication through pins 0 (RX) and 1 (TX). That built-in serial port is mainly used to communicate with your computer through the USB cable and Serial Monitor . But here is the problem beginners quickly face: Many popular modules use serial communication, such as: Bluetooth modules ( HC-05 / HC-06 ) GPS modules GSM modules Wi-Fi modules ( ESP8266 ) Arduino Uno has only one hardware serial port. So how can we connect these modules while still using the Serial Monitor? The solution is SoftwareSerial . In this tutorial you will learn how to create additional serial ports using normal digital pins. By the end, your Arduino will be able to talk to multiple serial devices. What is SoftwareSerial? SoftwareSerial is a special Arduino library that allows digital pins to behave like RX and TX pins. This means Arduino can create extra serial ports using software instead of hardware. Hardware Serial vs Software Seri...