maix.peripheral.adc

maix.peripheral.adc module

You can use maix.peripheral.adc to access this module with MaixPy
This module is generated from MaixCDK

Module

No module

Enum

Variable

RES_BIT_8

item doc
brief 8-bit resolution, supported by the actual hardware
value 8
readonly True

C++ defination code:

const int RES_BIT_8 = 8

RES_BIT_10

item doc
brief 10-bit resolution, supported by the actual hardware
value 10
readonly True

C++ defination code:

const int RES_BIT_10 = 10

RES_BIT_12

item doc
brief 12-bit resolution, supported by the actual hardware
value 12
readonly True

C++ defination code:

const int RES_BIT_12 = 12

RES_BIT_16

item doc
brief 16-bit resolution, supported by the actual hardware
value 16
readonly True

C++ defination code:

const int RES_BIT_16 = 16

Function

Class

ADC

item doc
brief Peripheral adc class

C++ defination code:

class ADC

__init__

def __init__(self, pin: int, resolution: int, vref: float = -1) -> None
item doc
type func
brief ADC constructor
param pin: direction [in], adc pin, int type
resolution: direction [in], adc resolution. default is -1, means use default resolution
option:
resolution = adc.RES_BIT_8, means 8-bit resolution
resolution = adc.RES_BIT_10, means 10-bit resolution
resolution = adc.RES_BIT_12, means 12-bit resolution
resolution = adc.RES_BIT_16, means 16-bit resolution
the default resolution is determined by actual hardware.
vref: direction [in], adc refer voltage. default is -1, means use default refer voltage.
the default vref is determined by actual hardware. range: [0.0, 10.0]
static False

C++ defination code:

ADC(int pin, int resolution, float vref = -1)

read

def read(self) -> int
item doc
type func
brief read adc value
return adc data, int type
if resolution is 8-bit, return value range is [0, 255]
if resolution is 10-bit, return value range is [0, 1023]
if resolution is 12-bit, return value range is [0, 4095]
if resolution is 16-bit, return value range is [0, 65535]
static False

C++ defination code:

int read()

read_vol

def read_vol(self) -> float
item doc
type func
brief read adc voltage
return adc voltage, float type。the range is [0.0, vref]
static False

C++ defination code:

float read_vol()