maix.peripheral.adc

maix.peripheral.adc module

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

Module

No module

Enum

Variable

RES_BIT_8

8-bit resolution, supported by the actual hardware

item description
value 8
readonly True

C++ defination code:

const int RES_BIT_8 = 8

RES_BIT_10

10-bit resolution, supported by the actual hardware

item description
value 10
readonly True

C++ defination code:

const int RES_BIT_10 = 10

RES_BIT_12

12-bit resolution, supported by the actual hardware

item description
value 12
readonly True

C++ defination code:

const int RES_BIT_12 = 12

RES_BIT_16

16-bit resolution, supported by the actual hardware

item description
value 16
readonly True

C++ defination code:

const int RES_BIT_16 = 16

Function

Class

ADC

Peripheral adc class

C++ defination code:

class ADC

__init__

def __init__(self, pin: int, resolution: int, vref: float = -1) -> None

ADC constructor

item description
type func
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

read adc value

item description
type func
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

read adc voltage

item description
type func
return adc voltage, float type。the range is [0.0, vref]
static False

C++ defination code:

float read_vol()