Closed
Description
Not a high priority but it looks like accidentally configuring a ADC using a pin string name will succeed:
adc = machine.ADC('A0')
However attempting to read values with read() will just return max value 4095.
>>> adc.read()
4095
The right way for this to work is to send a machine.Pin instance like:
adc = machine.ADC(machine.Pin('A0'))
Then the values are read as expected. However it's odd that passing a string vs. machine.Pin succeeds and doesn't fail with an error. Ideally we should catch this and throw an error that tells the user they need to specify a pin instance.