Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On an Arduino UNO R3, dim an external LED with analogWrite() on PWM pin 3, 5, 6, 9, 10, or 11, and create blink patterns by switching a digital output on and off for chosen durations. The built-in LED on pin 13 is handy for blinking, but it is not a PWM pin on the UNO R3.

What you need for an UNO R3 LED project

  • An Arduino UNO R3 and USB cable.
  • For an external LED: one ordinary LED, a suitable current-limiting resistor, a breadboard, and jumper wires.
  • For interactive brightness control: a potentiometer; Arduino’s Analog Read Serial tutorial lists a 10 kΩ potentiometer among its example hardware.

Arduino’s UNO R3 product documentation describes a board with 14 digital I/O pins, six PWM outputs, and six analog inputs. The resistor is essential in an external LED circuit: do not connect the LED directly to an output pin without current limiting. The cited Arduino reference establishes the need for a resistor, but not a particular resistor value; select one appropriate for your LED and circuit.

Which Arduino UNO pins support PWM?

On the UNO R3, PWM is available on digital pins 3, 5, 6, 9, 10, and 11. The Arduino UNO Rev3 with Long Pins reference documents an 8-bit analogWrite() value: 0 is off, 255 is full output, and values between them set intermediate duty cycles.

PWM, or pulse-width modulation, rapidly switches the output on and off and varies the fraction of time it is on. It is not a true analog voltage output. With an LED, the changing duty cycle is perceived as a change in brightness. The UNO R3’s built-in LED is connected to pin 13; use it for on/off blinking, not for this PWM fading sketch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
ELEGOO UNO R3 Project Super Starter Kit with PDF Tutorial for Beginners
  • TURN CODE INTO REAL-WORLD RESULTS — Follow 22+ guided lessons to make LEDs blink, read temperature and distance, move servo and stepper motors, control an LCD and respond to joystick or IR input; ideal for a family weekend build, homeschool unit, coding club or STEM classroom
  • MORE PROJECT VARIETY IN ONE ORGANIZED KIT — Includes the UNO R3 controller, LCD1602 with pre-soldered header, breadboard power module, ultrasonic and DHT11 sensors, joystick, IR receiver and remote, SG90 servo, stepper motor, relay, DC motor, fan blade, displays, LEDs, buttons, resistors and jumper wires
  • START WITHOUT SOLDERING — Plug-in modules, a solderless breadboard and the pre-soldered LCD help beginners focus on wiring, code and testing; the illustrated component list makes it easier to find each part and move from one lesson to the next
  • LEARN THE LOGIC, THEN CREATE YOUR OWN — Use Arduino IDE and the included example code to understand digital input and output, analog sensing, timing, motor control and display functions, then change thresholds, speeds and sequences for alarms, environmental monitors, reaction games and motion projects
  • CLEAR SETUP SUPPORT FOR FIRST-TIME BUILDERS — Download the latest tutorial and code, select the UNO board and correct computer port, check component polarity and breadboard rows, and keep power-module input at 9V or below; younger learners should work with an experienced adult

How do I wire an external LED for brightness control?

  1. Choose a PWM-capable pin, such as pin 9.
  2. Connect pin 9 through a suitable current-limiting resistor and the LED in series to GND. Observe the LED’s polarity; if it does not light, check its orientation and connections.
  3. Connect the UNO R3 to the computer and select the UNO R3 board and its port in the Arduino IDE.

The circuit’s order can be pin, resistor, LED, then ground, or pin, LED, resistor, then ground: the important points are that the resistor and LED are in series and the LED has the correct polarity.

How do I dim an LED with an Arduino UNO?

Initialize the PWM pin as an output and change the value passed to analogWrite(). This sketch fades the LED up and down by stepping through the documented 0–255 range:

Rank #2
ELEGOO UNO R3 Project Most Complete Starter Kit, Compatible with Arduino
  • 30+ Guided Electronics Projects: Start with LEDs and build toward LCD1602 displays, RFID access, motion detection, distance sensing, motor control and environmental monitoring for STEM learning, coding clubs, classrooms and hobby projects
  • 200+ Components Across 63 Types: Includes an ELEGOO UNO R3 controller, LCD1602, RC522 RFID, RTC, HC-SR501 PIR sensor, ultrasonic sensor, DHT11, GY-521, MAX7219, keypad, joystick, relay, SG90 servo, stepper motor, breadboard and more
  • Begin Without Soldering: Pre-soldered modules, a solderless breadboard, organized storage case and small-parts box reduce setup time and help beginners move from lesson to lesson while keeping LEDs, ICs, wires and sensors easy to find
  • Learn, Modify and Create: Program the ELEGOO UNO R3 board with Arduino IDE using the included PDF tutorial and example code, then adjust sensor thresholds, timing, display text and motor behavior to turn guided lessons into original projects
  • Flexible Power and Project Setup: Includes a 9 V, 1 A power supply, breadboard power module, 9 V battery and USB cable to support controller, breadboard and module experiments without sourcing basic setup accessories separately
const int ledPin = 9;

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

void loop() {
  for (int brightness = 0; brightness <= 255; brightness++) {
    analogWrite(ledPin, brightness);
    delay(10);
  }

  for (int brightness = 255; brightness >= 0; brightness--) {
    analogWrite(ledPin, brightness);
    delay(10);
  }
}

Use analogWrite(ledPin, 0) for off and analogWrite(ledPin, 255) for full output. The delays make each brightness step visible; change them to alter the fade speed. These delays also pause other work in the sketch, so use elapsed-time timing instead if the loop must keep responding to inputs or sensors.

Fixed brightness versus a potentiometer

Fixed PWM values are the simplest way to learn how duty cycle affects LED brightness. To let a potentiometer set brightness, connect its outer terminals to 5V and GND and its middle terminal (wiper) to an analog input, then map the analog reading to the PWM range. The UNO’s analog reading is 10-bit while PWM uses 8-bit values, so the input range must be scaled before calling analogWrite(). For the wiring and reading approach, see Arduino’s Analog Read Serial tutorial. The potentiometer is an optional extension, not a requirement for a fixed fade.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
REXQualis Super Starter Kit Based on Arduino UNO R3 with Tutorial and Controller Board Compatible with Arduino IDE
  • The most economical kit comes with everything compatible with Arduino to starting programming for beginners .
  • This is the upgraded starter kits come with a 9V 1A Power Adapter (At least $5.99 on amazon) to replace a 9V Battery , and the Lcd1602 module come with pin header(not need to be soldered by yourself).
  • Include High Quality Base Board base on Arduino UNO R3 compatible with Arduino IED and Sensors, Servo, Motor, ULN2003 driver board, lcds, etc.
  • Free PDF Tutorial and Datasheet are available to download from our official website or you can contact our customer service.
  • All of the Components and Integrated Circuits are individually packaged and labeled, and packing in a plastic box which is bigger enough for you.

How do I make an LED blink in a pattern?

A blink pattern is a sequence of output states and durations. Set a digital output HIGH for the on interval, then LOW for the off interval; vary those intervals to make short flashes, longer pauses, or groups of repeated flashes. For a first standalone pattern, delay() is the most direct approach:

const int ledPin = 13;

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

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

This repeats a short on interval followed by a longer off interval on the built-in pin-13 LED. Change the two delay durations to change the pattern. Arduino’s built-in examples include Blink, Fading a LED, and Blink Without Delay; they can be opened from the Arduino IDE’s bundled examples.

Rank #4
Sale
SunFounder Inventor Lab Starter Kit with Original Arduino Uno R3 REV3 Multimeter 34 Projects 40+Video Courses RAB Breadboard Holder, RoHS Compliant, for Beginners & Engineers
  • Comprehensive Arduino Learning: The kit includes an Original Arduino Uno R3, 34 lessons, step-by-step guidance, 40+ free Video Courses, code examples, circuit diagrams, and an RAB Holder for easy setup and component organization. Designed for beginners aged 8 and up. Certified RoHS compliant, it ensures safety and quality for all learners
  • Wide Range of Components: With over 200 components, including LEDs, buzzers, RFID modules, ultrasonic sensors, breadboard power supply module and multimeter, the kit enables hands-on learning and a deeper understanding of circuit design
  • Practical Real-World Projects: Engage in projects like smart trash cans, automatic soap dispensers, and remote-controlled lights. Each project builds incrementally, enhancing skills and creativity while offering real-world applications of electronics and coding
  • Perfect for Beginners: The handbook breaks down complex concepts into easy-to-follow steps, ensuring that even users with no prior experience can dive into electronics and programming with confidence
  • Exceptional Support and Community: Access extensive resources from SunFounder, including tutorials, technical support, and an active online community. Learners can share ideas, ask for help, and explore new projects, enriching their learning journey

When to use Blink Without Delay

delay() stops the sketch from doing other work while it waits. That is acceptable for a self-contained demonstration, but it can interfere with reading a button, checking a sensor, or updating another output. Arduino’s Blink Without Delay example uses elapsed time to change output states while letting loop() continue running. Base each change on the time elapsed since the previous state change, and adjust the interval for each part of the pattern. Use this approach when a pattern needs to coexist with repeated tasks.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

UNO R3 capabilities relevant to this project

Feature UNO R3 detail
Digital I/O pins 14, according to Arduino’s UNO R3 product documentation
PWM-capable pins 3, 5, 6, 9, 10, and 11, according to the UNO Rev3 reference
analogWrite() resolution 8-bit, or 0–255, according to the UNO Rev3 reference
Built-in LED Pin 13; suitable for blinking, not PWM fading on UNO R3, according to the UNO Rev3 reference

These pin details are specific to the UNO R3. Do not assume they apply unchanged to UNO R4 or another Arduino board; check that board’s documentation before reusing the pin choices or code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
ELEGOO Mega 2560 R3 Project The Most Complete Starter Kit with Tutorial
  • 35+ Guided Electronics Projects: Progress from LEDs and buttons to RFID access, real-time clocks, motion and distance sensing, environmental monitoring, motor control and interactive displays for STEM learning, coding clubs and maker projects
  • More I/O and Memory for Larger Builds: The MEGA 2560 R3 provides 54 digital I/O pins, including 15 PWM outputs, 16 analog inputs, 4 hardware serial ports and 256 KB flash for projects that combine more sensors, controls and displays
  • 200+ Components for Prototyping: Includes LCD1602, RC522 RFID, RTC, DHT11, HC-SR501 PIR, ultrasonic and water-level sensors, GY-521, MAX7219, keypad, joystick, rotary encoder, relay, SG90 servo, stepper motor, DC motor, breadboard and more
  • Learn, Modify and Create: Follow 35+ guided lessons with example code, then adjust sensor thresholds, timing, display text, motor behavior and control logic to turn structured exercises into access systems, monitors, alarms and interactive projects
  • Organized for Repeatable Learning: Pre-soldered modules, a solderless breadboard, storage case and small-parts box reduce setup time and keep sensors, LEDs, ICs, wires and other components easy to find between projects

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.