ADC Unit

Support the following products:

ADC

Micropython Example:

import os, sys, io
import M5
from M5 import *
import time
from unit import *

adc_0 = None

def setup():
global adc_0

print(adc_0.get_voltage())
time.sleep(1)

UIFLOW2 Example:

example.svg

adc_core_example.m5f2

class ADCUnit

Constructors

class ADCUnit(i2c0)

Create an ADCUnit object.

parameters is:
  • I2C0 is I2C Port.

UIFLOW2:

init.svg

Methods

ADCUnit.get_value()

Gets the original value read by the adc.

UIFLOW2:

get_value.svg

ADCUnit.get_voltage()

Get the voltage value.

UIFLOW2:

get_voltage.svg

ADCUnit.get_raw_value()

Read the raw value.

UIFLOW2:

get_raw_value.svg

ADCUnit.get_operating_mode()

Get working mode. (Single read or continuous read)

UIFLOW2:

get_operating_mode.svg

ADCUnit.get_data_rate()

Get the read rate of the data.

UIFLOW2:

get_data_rate.svg

ADCUnit.get_gain()

Get the gain multiple of the data.

UIFLOW2:

get_gain.svg

ADCUnit.operating_mode()

Set working mode (single read or continuous read)

UIFLOW2:

set_operating_mode.svg

ADCUnit.data_rate()

Set the data acquisition rate.

UIFLOW2:

set_data_rate.svg

ADCUnit.gain()

Set the gain multiple for reading data.

UIFLOW2:

set_gain.svg