UIFlow Guide
设置mini encoder通讯地址,设置灯的颜色为白色,串口实时打印编码器的数值和按键的状态值
from m5stack import *
from m5ui import *
from uiflow import *
import hat
setScreenColor(0x111111)
hat_mini_encoderc_0 = hat.get(hat.MINI_ENCODERC)
hat_mini_encoderc_0.init_i2c_address(0x42)
hat_mini_encoderc_0.set_LED_RGB24(50, 50, 50)
while True:
print(hat_mini_encoderc_0.get_counter_value())
print(hat_mini_encoderc_0.get_button_status())
wait_ms(2)