Reading a Potentiometer
ADC_VREF is the ADC power supply (and reference) voltage, and is generated on Pico by filtering the 3.3V supply. This pin can be used with an external reference if better ADC performance is required. AGND is the ground reference for GPIO26-29, there is a separate analog ground plane running under these signals and terminating at this pin.
1 2 3 4 5 6 7
Connect the positive to pin 35 ADC_REF (row 6 on the breadboard) and the negative to pin 33 AGND (row 8 on the breadboard). The Pico has special noise reduction circuits to avoid power supply jitter on these reference pins.
Sometimes the data coming from your Potentiometer is noisy. You can sample the value multiple times and then average the values.
Here is a sample program. Just pass in the pin and a count and it will return the average values. This version waits 5 milliseconds between samples.
1 2 3 4 5 6
1 2 3