07 30 minutes
Brightness knob
An analog input turns a physical twist into a number

Mission goal: Wire a 10 kΩ potentiometer into ADC0 on GP26 and use its reading to set the LED's PWM brightness in real time.
Section 1
Understand
New ideas
- Analog versus digital inputs
- A potentiometer as an adjustable voltage divider
- read_u16 and its reported 0 to 65535 range
- The difference between reported range and real precision
- 1A knob (potentiometer) turns a twist into a voltage.
- 2The ADC reads that voltage as a number from 0 to 65535.
- 3That number sets the LED brightness directly.
Safety first
- Unplug before wiring the potentiometer.
- Take 3.3 V from 3V3 OUT at physical pin 36. Never use VBUS or VSYS, which carry 5 V.
- Make sure the two outer pot legs are not both in the same breadboard row, which would short 3.3 V straight to ground.