Potentiometer LED Brightness
Turn a potentiometer to control LED brightness through the ADC and a PWM output.

Wire it up
Disconnect power before changing connections. Follow terminal names rather than wire colors.
| From | To | Why it matters |
|---|---|---|
| Uno · 9 | Resistor (r-led1) · 1 | Match this terminal to the sketch |
| Resistor (r-led1) · 2 | LED (led1) · A | Match this terminal to the sketch |
| LED (led1) · C | Uno · GND.1 | Ground reference |
| Potentiometer (pot1) · VCC | Uno · 5V | Power connection |
| Potentiometer (pot1) · GND | Uno · GND.2 | Ground reference |
| Potentiometer (pot1) · SIG | Uno · A0 | Match this terminal to the sketch |
The complete sketch
void setup() { pinMode(9, OUTPUT); }
void loop() {
int sample = analogRead(A0);
analogWrite(9, sample / 4);
delay(10);
}
The launch buttons use this same code and a matching saved circuit.
Build it step by step
Open a complete project
Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.
Explore the live circuit
Rotate the simulated knob and watch the LED change without restarting.
Try it on hardware
Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.
Understand the sketch
10-bit input to 8-bit output
The ADC returns 0–1023. Integer division by four maps it to 0–255 for analogWrite. The potentiometer is a voltage divider; its wiper feeds A0.
If something is different
Brightness does not change
Connect SIG to A0, VCC to 5 V, and GND to ground. Do not connect the wiper to a power rail.
Expected output and tested scope
Turning the potentiometer changes the ADC reading and the LED PWM brightness.
Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.
Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.