pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Atomic QRCode

案例程序

from m5stack import *
from m5ui import *
from uiflow import *
from base.QRCode import QRCode

scan_data = None

qr = QRCode()
while True:
  if btnA.isPressed():
    qr.trigger(0)
  else:
    qr.trigger(1)
  if qr.status():
    scan_data = qr.read()
    if scan_data != None:
      print(scan_data)
  wait_ms(2)

功能说明

from base.QRCode import QRCode
qr = QRCode()
  • 初始化Atomic QRCode
qr.trigger(control)
  • QRCode扫描控制:
    • ON: 0
    • OFF: 1
qr.status()
  • QRCode扫描状态:
    • True: 扫描成功
    • False: 未扫描到内容
qr.read()
  • 读取扫描结果字符串
On This Page