# Analog to Digital Conversion¶

This module loads the Analog to Digital Converter (adc) driver of the embedded device.

When imported, automatically sets the system adc driver to the default one.

init(drvname, samples_per_second=800000)

Loads the adc driver identified by drvname and sets it up to read samples_per_second samples per second. The default is a sampling frequency of 0.8 MHz, valid values are dependent on the board.

Returns the previous driver without disabling it.

done(drvname)

read(pin, samples=1)
import adc

this piece of code sets x to ((...),(...),(...)) where each inner tuple contains 6 samples taken from the corresponding channel. To use less memory, the inner tuples can be bytes, or shorts or normal tuples, depending on the hardware resolution of the adc unit. The number of sequentials pins that can be read in a single call depends on the specific board.