My First Arduino Project — Breathing LED!
No breadboard, no wires, no resistor needed. Just my Arduino UNO R4 WiFi and its built-in LED. Let's make it glow like it's breathing!
Today I uploaded my very first Arduino program! 🎉
The best part? I didn’t even need a breadboard or extra components. The Arduino UNO R4 WiFi has a built-in LED right on the board, connected to pin 13.
What does the project do?
The LED slowly fades in and fades out, like a calm breathing light. It uses something called PWM (Pulse Width Modulation) — a fancy way of turning the LED on and off very fast so our eyes see it as dimming.
What you need
- Arduino UNO R4 WiFi (or any Arduino with a built-in LED on pin 13)
- A USB cable to connect it to your computer
That’s it! 🙌
The code
/*
Breathing LED for Arduino UNO R4 WiFi
Fades the built-in LED on pin 13 smoothly in and out.
*/
const int LED_PIN = 13; // Built-in LED on Arduino R4
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Breathing LED started!");
}
void loop() {
// Fade in: brightness 0 to 255
for (int brightness = 0; brightness <= 255; brightness += 5) {
analogWrite(LED_PIN, brightness);
delay(20);
}
// Fade out: brightness 255 to 0
for (int brightness = 255; brightness >= 0; brightness -= 5) {
analogWrite(LED_PIN, brightness);
delay(20);
}
// Small pause at the bottom of each breath
delay(200);
}
How I uploaded it
I used the Arduino CLI from my computer. These were the commands:
# Check that the board is connected
arduino-cli board list
# Compile the sketch
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi BreathingLED
# Upload it to the board
arduino-cli upload -p /dev/cu.usbmodem9888E00970202 --fqbn arduino:renesas_uno:unor4wifi BreathingLED
If you’re on Windows, your port will look something like COM3 instead of /dev/cu.usbmodem....
How it works
pinMode(LED_PIN, OUTPUT);tells the Arduino that pin 13 is an output.analogWrite(LED_PIN, brightness);sets the LED brightness from0(off) to255(full brightness).- The first
forloop increases brightness step by step → the LED fades in. - The second
forloop decreases brightness step by step → the LED fades out. delay(20)makes each step last 20 milliseconds, so the fade looks smooth.
Try changing it!
- Make it breathe faster by changing
delay(20)todelay(10). - Make it breathe slower by changing it to
delay(50). - Remove the final
delay(200)if you don’t want a pause.
What’s next?
Next, I want to:
- Wire my own external LED with a resistor.
- Make the LED blink in patterns like an ambulance or heartbeat.
- Use the RGB LED on the R4 WiFi to make colourful lights!
Have fun making your Arduino glow! 💡
If you liked this, follow my journey on NitviTalks YouTube and subscribe for more beginner-friendly electronics projects.