import sensor, image, time
from servo import Servos
from pyb import UART
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # 必须关闭此功能,以防止图像冲洗…
clock = time.clock()
uart = UART(1, 115200)
while(True):
clock.tick()
img = sensor.snapshot()
img.lens_corr(1.8) # 1.8的强度参数对于2.8mm镜头来说是不错的。
for code in img.find_qrcodes():
img.draw_rectangle(code.rect(), color = (255, 0, 0))
message = code.payload()
print(message)
#6+123
if message=='123+123':
message='RGBrgb'
uart.write(message+'\r\n')
if uart.any ():
a=uart.readline ()
print(a)
flag=1
if flag:
break
D
dnlx
@dnlx
0
声望
1
楼层
330
资料浏览
0
粉丝
0
关注
dnlx 发布的帖子
-
在使用串口1时,需要更改那些配置文件,直接写成uart=UART(1,115200).串口接收不到数据