while(True):
bus.recv(3, timeout=10000) # 首先发送长度 (16-bits).
clock.tick()
img = sensor.snapshot()
codes = img.find_barcodes()
K=a
#---条形码扫描代码-------
if K==1:
for code in codes:
img.draw_rectangle(code.rect())
print_args = (barcode_name(code), code.payload(), (180 * code.rotation()) / math.pi, code.quality(), clock.fps())
# print("Barcode %s, Payload \"%s\", rotation %f (degrees), quality %d, FPS %f" % print_args)
QR = code.payload()
print(QR) #输出二维码内容https://book.openmv.cc/example/02-Board-Control/arduino-i2c-slave.html
你是说这个程序?用i2c slave不明智,因为图像处理需要时间,可能会导致应答i2c超时。
使用uart明显更简单。
@kidswong999 好 我试试用uart