UIFlow 上手教程
发送 Hello 语音指令,执行打印程序(Print)
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x222222)
asr_0 = unit.get(unit.ASR, unit.PORTC)
def asr_0_hello_event(args):
# global params
print('I am Fine')
asr_0.init(2)
asr_0.add_command_word(0x32, 'hello', asr_0_hello_event)
print((str('raw message:') + str((asr_0.get_current_raw_message()))))
while True:
asr_0.handler()
wait_ms(2)
asr_0.init(2)
def asr_0_hello_event(args):
# global params
pass
print((str('current command handler state:') + str((asr_0.get_command_handler()))))
print((str('current command list:') + str((asr_0.get_command_list()))))
print((str('current command num:') + str((asr_0.get_current_command_num()))))
print((str('current command word:') + str((asr_0.get_current_command_word()))))
asr_0.add_command_word(0x32, 'hello', _)
print((str('current raw message:') + str((asr_0.get_current_raw_message()))))
print((str('receive message:') + str((asr_0.get_received_status()))))
asr_0.remove_command_word('hello')
print((str('command word:') + str((asr_0.search_command_num('')))))
print((str('command word(hex):') + str((asr_0.search_command_word(0x32)))))
asr_0.send_message(0xFE)
asr_0.handler()