
UiFlow Tutorial
Rotary encoder counting
from m5stack import *
from m5stack_ui import *
from uiflow import *
import unit
screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
encoder_0 = unit.get(unit.ENCODER_LED, unit.PORTA)
while True:
if encoder_0.get_button_status():
print((str('count:') + str((encoder_0.get_encoder_count()))))
encoder_0.set_LED_RGB(3, 0xff0000)
wait_ms(2) print((str('button:') + str((encoder_0.get_button_status())))) print((str('count:') + str((encoder_0.get_encoder_count())))) encoder_0.reset_count() encoder_0.set_LED_RGB(3, 0xff0000) encoder_0.set_LED_RGB(3, 0xff0000) encoder_0.set_encoder_count(1000) encoder_0.set_encoder_mode(0) encoder_0.set_LED_RGB(3, 0x000000)