adafruit-beaglebone-io-python/docs/ADC.rst
2017-12-05 08:44:52 +01:00

45 lines
1.1 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:mod:`ADC` --- A/D Converter input interface
--------------------------------------------
This module enables reading analog input values from the analog to digital
converter (ADC) on the Beaglebone processor.
Example::
import Adafruit_BBIO.ADC as ADC
ADC.setup()
# The read method returns normalized values from 0 to 1.0
value = ADC.read("P9_40")
# The read_raw returns non-normalized values from 0 to 4095
value = ADC.read_raw("P9_40")
.. module:: Adafruit_BBIO.ADC
.. function:: setup_adc()
Setup and start the ADC hardware.
.. function:: setup_read(channel)
Read the normalized analog value for the channel.
:param str channel: GPIO channel to read the value from (e.g. "P8_16").
:returns: normalized value reading from 0.0 to 1.0
:rtype: float
.. function:: setup_read_raw(channel)
Read the raw analog value for the channel.
:note: Kernels older than 4.1.x returned a raw value range based on
the reference voltage of 1.8 V from 0 to 1800.
:param str channel: GPIO channel to read the value from (e.g. "P8_16").
:returns: raw value reading from 0 to 4095 (12 bits).
:rtype: float