Simple LED brightness control using PWM on Arduino Uno.
This project demonstrates how to control the brightness of an LED using Pulse Width Modulation (PWM) on an Arduino Uno.
The LED smoothly fades in and out by changing the PWM duty cycle on digital pin 9.
This technique simulates analog output by rapidly switching the LED ON and OFF at different intervals.
- 1x Arduino Uno (or compatible board)
- 1x LED
- 1x 220 Ω resistor
- Jumper wires
- Pin 9 → LED anode (long leg)
- LED cathode (short leg) → resistor → GND
The Arduino sends a PWM signal (0–255 duty cycle) through pin 9.
The analogWrite() function adjusts how long the signal stays ON versus OFF.
As the duty cycle increases, the LED appears brighter; as it decreases, it dims.
This loop creates a smooth fade effect.