# https://www.youtube.com/watch?v=mTz-nFvCBhA
# ADC Analog to Digital Converter
from machine import ADC
from time import sleep
# Only certian pins can be used for analog input
# GP26, GP27, GP28
pot = ADC(26)
while True:
pot_value = pot.read_u16()
sleep(0.05)
print(pot_value)
# https://docs.micropython.org/en/latest/rp2/quickref.html
# RP2040 has five ADC channels in total, four of which
# are 12-bit SAR based ADCs: GP26, GP27, GP28 and
# GP29. The input signal for ADC0, ADC1, ADC2 and ADC3
# can be connected with GP26, GP27, GP28, GP29
# respectively (On Pico board, GP29 is connected to
# VSYS). The standard ADC range is 0-3.3V. The fifth
# channel is connected to the in-built temperature
# sensor and can be used for measuring the temperature.