machine.ADC =========== .. This document was autogenerated by Sphinx-autoapi from a .pyi stub or a source code file. .. Do not edit this file, instead edit the source file and run Sphinx to update. .. Source: docs/stubs/machine/ADC.pyi .. py:module:: machine.ADC Attributes ---------- .. autoapisummary:: machine.ADC.ATTN_0DB Classes ------- .. autoapisummary:: machine.ADC.ADC Module Contents --------------- .. py:class:: ADC(id, *, sample_ns: Optional[int] = 0, atten: Optional[int] = ATTN_0DB) Access the ADC associated with a source identified by *id*. This *id* may be an integer (usually specifying a channel number), a :ref:`Pin ` object, or other value supported by the underlying machine. If additional keyword-arguments are given then they will configure various aspects of the ADC. If not given, these settings will take previous or default values. The settings are: - *sample_ns* is the sampling time in nanoseconds. - *atten* specifies the input attenuation. .. py:method:: block() -> _typeshed.Incomplete Return the :ref:`ADCBlock ` instance associated with this ADC object. This method only exists if the port supports the :ref:`ADCBlock ` class. .. py:method:: init(*, sample_ns, atten) -> _typeshed.Incomplete Apply the given settings to the ADC. Only those arguments that are specified will be changed. See the ADC constructor above for what the arguments are. .. py:method:: read_u16() -> int Take an analog reading and return an integer in the range 0-65535. The return value represents the raw reading taken by the ADC, scaled such that the minimum value is 0 and the maximum value is 65535. .. py:method:: read_uv() -> int Take an analog reading and return an integer value with units of microvolts. It is up to the particular port whether or not this value is calibrated, and how calibration is done. .. py:data:: ATTN_0DB :type: int :value: Ellipsis