DLight Unit

Support the following products:

Dlight

Micropython Example:

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

i2c0 = None
dlight_0 = None

def setup():
global i2c0, dlight_0

i2c0 = I2C(0, scl=Pin(1), sda=Pin(2), freq=100000)
dlight_0 = DLight(i2c0)
print(dlight_0.get_lux())
M5.begin()
Widgets.fillScreen(0x222222)

UIFLOW2 Example:

example.svg

dlight_core_example.m5f2

class DLight

Constructors

class DLightUnit(i2c, address: int = 0x23)

Create a DLight object.

Parameters:
  • i2c – the I2C object.

  • address – the I2C address of the device. Default is 0x23.

UIFLOW2:

init.svg

Methods

DLightUnit.get_lux()

Get light lux.

UIFLOW2:

get_lux.svg

DLightUnit.configure()

Configure the measurement mode (continuous measurement/single measurement) and resolution.

UIFLOW2:

configure.svg