Make an LED blink, then turn a knob to fade it from off to full brightness. You will learn how to wire an LED safely and how the UNO can dim a light.
| Part | How many |
|---|---|
| UNO R3 + USB cable | 1 |
| 400-point breadboard | 1 |
| Yellow LED | 1 |
| 220 Ω resistor (red-red-brown) | 1 |
| 10K potentiometer | 1 |
| Male-to-male jumper wires | about 7 |
Nothing extra - just the kit and your computer.
An LED only works one way round: current goes in through the long leg (+) and out through the short leg (−). On its own it would take too much current, so a 220 Ω resistor always goes in line with it to protect the LED and the UNO pin.
digitalWrite(3, HIGH) puts 5 volts on pin 3 and the LED lights. LOW turns it off. That is how the 3 blinks at the start work.
The potentiometer is a knob. Its middle pin gives a voltage between 0 and 5V depending on how far you turn it, and analogRead(A0) turns that into a number from 0 to 1023.
The UNO cannot make "half a volt". Instead analogWrite() switches pin 3 on and off very fast (PWM). On for half the time looks half as bright. 0 is off, 255 is full brightness.
Every item is in the kit — nothing extra to buy.
All 10 parts in one box, with this project and 6 more to build from them.
One of each part. Packs (resistor assortment, jumper wires) already hold more than a single build needs. Delivery is AED 20, free on orders AED 100+.
Unplug USB before you change any wire. Pin names are the labels printed on the board.
| Part / pin | Connect to | Note |
|---|---|---|
| UNO 5V | + rail (red line) | Powers the knob |
| UNO GND | − rail (blue line) | Shared ground for everything |
| UNO pin 3 | 220 Ω resistor → yellow LED long leg (+) | Pin 3 has a ~ mark, so it can dim |
| Yellow LED short leg (−) | − rail (GND) | |
| Potentiometer outer pin | + rail (5V) | Either outer pin |
| Potentiometer other outer pin | − rail (GND) | |
| Potentiometer middle pin | UNO A0 | On the lower header, by ANALOG IN |
One thing at a time. Tick nothing off until it matches the diagram.
Written for the board in the kit. Copy it into the Arduino IDE; change the pin numbers if you wire it differently.
/*
DIY KIT - Arduino UNO Sensor & Output Starter Kit
Lesson 1 of 7: LED Basics & Brightness
WIRING (unplug the USB cable before you wire)
Yellow LED long leg (+) -> 220 ohm resistor -> UNO pin 3
Yellow LED short leg (-) -> GND
Potentiometer outer pins -> 5V and GND (either way round)
Potentiometer middle pin -> UNO pin A0
WHAT SHOULD HAPPEN
1. The LED blinks 3 times. That proves the LED is wired the right way.
2. Then turn the knob: the LED fades from off to fully bright.
*/
const int LED_PIN = 3; // the yellow LED. Pin 3 has a ~ mark, so it can dim (PWM)
const int KNOB_PIN = A0; // the middle pin of the potentiometer
const int BLINK_MS = 300; // how long each start-up blink lasts, in milliseconds
void setup() {
pinMode(LED_PIN, OUTPUT); // pin 3 sends power OUT to the LED
Serial.begin(9600); // talk to the computer (Serial Monitor at 9600 baud)
Serial.println("Lesson 1: LED Basics & Brightness");
// Part A: blink 3 times so you know the LED works.
for (int i = 1; i <= 3; i++) {
digitalWrite(LED_PIN, HIGH); // HIGH = 5 volts = LED on
delay(BLINK_MS); // wait
digitalWrite(LED_PIN, LOW); // LOW = 0 volts = LED off
delay(BLINK_MS);
}
Serial.println("Now turn the knob");
}
void loop() {
// Part B: the knob sets the brightness.
int knob = analogRead(KNOB_PIN); // 0 at one end of the turn ... 1023 at the other
int brightness = map(knob, 0, 1023, 0, 255); // squeeze 0-1023 into 0-255
analogWrite(LED_PIN, brightness); // 0 = off, 128 = half, 255 = full
// Two numbers the Serial Plotter can draw as lines.
Serial.print("knob:");
Serial.print(knob);
Serial.print(",brightness:");
Serial.println(brightness);
delay(100); // 10 readings a second is plenty
}
| In the code | What it does |
|---|---|
| const int LED_PIN = 3; | Gives pin 3 a name. If you ever move the LED, you only change this number. |
| setup() | Runs once when the UNO starts. It makes pin 3 an OUTPUT and blinks the LED 3 times with digitalWrite() and delay(). |
| loop() | Runs again and again: read the knob (analogRead), change 0-1023 into 0-255 (map), set the brightness (analogWrite). |
| Serial.print(...) | Sends the two numbers to your computer. Open Tools → Serial Monitor or Serial Plotter at 9600 baud to see them. |
| Problem | What to check |
|---|---|
| The LED never lights, not even the 3 blinks | Unplug USB. The LED is probably the wrong way round: turn it so the long leg is in the resistor's row. Check the wire goes to pin 3 and the short leg reaches the − rail. |
| The LED blinks 3 times but the knob does nothing | The LED is fine. Check the potentiometer: middle pin to A0, outer pins to the + and − rails. |
| The LED is only fully on or fully off | The wire is on a pin without a ~ mark. Move it to pin 3. |
| The LED is very dim even at full brightness | Check the resistor colours: red-red-brown is 220 Ω. Brown-black-orange is 10 kΩ, which is far too big. |
| The knob works backwards | Nothing is wrong. Swap the two outer potentiometer wires if you prefer the other way. |
| The upload fails | See Start here, step 6: "If the upload fails". |
Cover the LED with a sheet of paper and turn the knob up slowly. At what knob number (shown in the Serial Monitor) can you first see light through the paper?
To limit the current, so the LED and the UNO pin are not damaged.
The long leg.
0 at one end and 1023 at the other.
Only those pins can do PWM, the fast on-off switching that analogWrite() uses to dim the LED.
Most problems are one wire in the wrong hole. Check these first:
Open the troubleshooting table for this step →
Hi DIY KIT, I'm stuck on the Arduino UNO Sensor & Output Starter Kit. Lesson: __ Step number: __ What should happen: __ What happens instead: __ Error message (copied exactly): __ I'll attach a photo of my wiring.
Three LEDs run the red, red + yellow, green, yellow cycle of a real traffic light. Learn timing with delay() and write your own function.
The buzzer plays a slow beep, a fast alarm and SOS in Morse code. Type 0-3 in the Serial Monitor to choose: your first commands from the computer.
Measure distance with sound. The HC-SR04 times an echo and the UNO turns it into centimetres, drawn live in the Serial Plotter.
We use cookies that the shop needs to work — signing in, your cart, form security. We also measure how the shop is used so we can stock the right parts and fix what is broken. Choose “Only essential” and we will not load Google Analytics or the Meta pixel, and will not record your visit. Read more.