# QRCode Example
#
# This example shows the power of the OpenMV Cam to detect QR Codes
# without needing lens correction.
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((240, 240)) # look at center 240x240 pixels of the VGA resolution.
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for code in img.find_qrcodes():
m=code.payload()
break
s=list(m)
print(s)请提供报错提示截图以及现象

你的程序逻辑有问题。
没有检测到二维码的时候,m就不会被赋值。
那我想要调用扫面出来的二维码信息应该怎么写?就是跳出while 循环使用数据
程序应该永远都在死循环里。
while(True):
img = sensor.snapshot()
for code in img.find_qrcodes():
m=code.payload()
print(m)但是我只想让它扫描出一次数据就可以了,不需要无限循环,该怎么做呢
不会有这种需求的。难道一个设备只能开机运行一次,就要手动重启?
是这样的,我想用扫描出的二维码信息来执行后面的程序,如果一直在while循环里面就执行不了后面的程序了
你的逻辑是有问题的
while(True):
img = sensor.snapshot()
codes = img.find_qrcodes()
if codes:#如果找到了二维码
for code in codes:#你的图像里可能有好几个二维码
m=code.payload()#每一个二维码的数据
print(m)
#如果找到了二维码就在这里处理
else:
print('not found')
如果找不到就在这里写