Speed knob: potentiometer + analogRead
A potentiometer (5V, wiper → A0, GND) gives 0–5 V; analogRead(A0) turns it into 0–1023, and delay(knob / 4 + 20) makes the chaser 20–275 ms per LED.
Turn a knob, change the speed 🎛️
THE KNOB: a potentiometer is a resistor track with a sliding contact (the wiper). Outer legs go to 5V and GND, the middle leg goes to A0. Turn it and the wiper gives any voltage from 0 V to 5 V. It's a voltage divider you can turn!
analogRead(A0): the Uno turns 0–5 V into a number from 0 to 1023 (10-bit, 1024 steps). 0 V = 0, 2.5 V ≈ 512, 5 V = 1023.
THE CODE: only 2 lines changed from the LED chaser. int knob = analogRead(A0); reads the knob every step, and delay(knob / 4 + 20); turns it into a wait of 20 to 275 ms.
Big number = long wait = slow. Small number = short wait = FAST. Shown at real speed.
Related lessons
Get new lessons + early access to the full course
One email when new lessons drop. No spam, unsubscribe any time.
✓ You're on the list. Check your inbox to confirm.
By joining you agree to the privacy policy.




