class ADC – analog to digital conversion: read analog values on a pin¶
Usage:
import pyb
adc = pyb.ADC(pin) # create an analog object on one of the 4 ADC channels
val = adc.read() # read an analog value
adc.deinit() # disable the adc channel
adc.init() # enable the adc channel
Constructors¶
-
class
pyb.
ADC
(pin) Create an ADC object associated with the given pin. This allows you to then read analog values on that pin. For more info check the pinout and alternate functions table.
Warning
ADC pin input range is 0-1.4V (being 1.8V the absolute maximum that it can withstand). When GP2, GP3, GP4 or GP5 are remapped to the ADC block, 1.8 V is the maximum. If these pins are used in digital mode, then the maximum allowed input is 3.6V.