UIFlow Guide
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x444444)
dcssr_0 = unit.get(unit.DC_SSR, unit.PORTA)
def buttonA_wasPressed():
# global params
dcssr_0.set_i2c_ssr_state(1)
pass
btnA.wasPressed(buttonA_wasPressed)
def buttonB_wasPressed():
# global params
dcssr_0.set_i2c_ssr_state(0)
pass
btnB.wasPressed(buttonB_wasPressed)
def buttonC_wasPressed():
# global params
dcssr_0.set_i2c_rgb_led(50, 50, 50)
pass
btnC.wasPressed(buttonC_wasPressed)
dcssr_0.init_mode(1)
print((str('FW version:') + str((dcssr_0.get_i2c_status(0xFE)))))
while True:
if dcssr_0.get_i2c_ssr_status():
print('ON')
else:
print('OFF')
wait_ms(2)
dcssr_0.init_i2c_address(0x50)
dcssr_0.init_modbus(4, 1, 115200, 8, 1, None)
print(dcssr_0.get_i2c_rgb_led())
print(dcssr_0.get_i2c_ssr_status())
print(dcssr_0.get_i2c_status(0xFE))
print(dcssr_0.get_modbus_rgb_led())
print(dcssr_0.get_i2c_ssr_status())
print(dcssr_0.get_modbus_ssr_status())
dcssr_0.init_mode(1)
dcssr_0.set_i2c_address(0x50)
dcssr_0.set_i2c_rgb_led(50, 50, 50)
dcssr_0.set_i2c_ssr_state(1)
dcssr_0.set_modbus_address(0x50)
dcssr_0.set_modbus_rgb_led(50, 50, 50)
dcssr_0.set_modbus_ssr_state(1)