pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Mini Encoderc

案例程序

设置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)

功能说明


  • uiflow_block_hat_miniencoderc_init

  • uiflow_block_hat_miniencoderc_get_button_status

  • uiflow_block_hat_miniencoderc_get_counter_value

  • uiflow_block_hat_miniencoderc_get_device_status

  • uiflow_block_hat_miniencoderc_get_increment_value

  • uiflow_block_hat_miniencoderc_reset_counter_value

  • uiflow_block_hat_miniencoderc_set_counter_value

  • uiflow_block_hat_miniencoderc_set_i2c_address

  • uiflow_block_hat_miniencoderc_set_led_rgb
On This Page