logo

请问这个例程怎么用上去,想把IIC从总线读到的值放到K里,判断情况。

2021-08-02 21:11
U
vq6a
image
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)   #输出二维码内容
2021-08-03 12:44
I
网红小智智 星瞳科技

https://book.openmv.cc/example/02-Board-Control/arduino-i2c-slave.html

你是说这个程序?用i2c slave不明智,因为图像处理需要时间,可能会导致应答i2c超时。

使用uart明显更简单。

2021-08-03 14:05
U
vq6a

@kidswong999 好 我试试用uart