UIFlow Guide
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0x222222)
dlight_0 = unit.get(unit.DLIGHT, unit.PORTA)
def buttonA_wasPressed():
# global params
dlight_0.set_mode(0x10)
print('Continous Mode 1')
pass
btnA.wasPressed(buttonA_wasPressed)
def buttonB_wasPressed():
# global params
dlight_0.set_mode(0x20)
print('One Shot Mode 1')
pass
btnB.wasPressed(buttonB_wasPressed)
def buttonC_wasPressed():
# global params
dlight_0.set_mode(0x07)
print('Reset')
pass
btnC.wasPressed(buttonC_wasPressed)
while True:
print((str('lux value:') + str((dlight_0.get_lux()))))
wait_ms(250)
wait_ms(2)
print((str('Lux value:') + str((dlight_0.get_lux()))))
dlight_0.set_mode(0x10)
dlight_0.set_mode(0x20)
dlight_0.set_mode(0x00)