UIFlow Guide
自动扫描二维码
from m5stack import *
from m5ui import *
from uiflow import *
import unit
setScreenColor(0x222222)
qrcode_0 = unit.get(unit.QRCODE, unit.PORTA)
qrcode_0.init_device_mode(0, 0x21)
qrcode_0.set_trigger_mode(0)
qrcode_0.set_manual_scan(1)
while True:
if qrcode_0.get_qrcode_data_status():
print(qrcode_0.get_qrcode_data(False))
wait_ms(2)
qrcode_0.init_device_mode(0, 0x21)
qrcode_0.clear_qrcode_data_status()
print(qrcode_0.get_qrcode_data_status())
print(qrcode_0.get_qrcode_data(False))
print(qrcode_0.get_qrcode_data_length())
print(qrcode_0.get_device_info(0xFE))
print(qrcode_0.get_trigger_button_status())
print(qrcode_0.get_trigger_mode())
qrcode_0.set_device_i2c_address(0x21)
qrcode_0.set_manual_scan(1)
qrcode_0.set_trigger_mode(0)