
打开图像拍照这一句的时候,串口接收数据正常

屏蔽掉之后,串口接收到数据就不是字符串了
这是什么问题啊
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
import sensor, image, time
from pyb import UART
sensor.reset()#初始化相机传感器
#sensor.set_vflip(True)#垂直翻转
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.SVGA)#800x600
sensor.skip_frames(time = 200)#让图像稳定
uart = UART(3,9600)
print("You're on camera!")
PhotoNum=0
while(True):
#img = sensor.snapshot()
if (uart.any()):
Data = uart.readline().decode()
print(Data)
if Data == 'photo':
PhotoNum = PhotoNum+1
print("Save",PhotoNum)
sensor.snapshot().save('/Bottle/'+str(PhotoNum)+'.jpg' )#存储图像
uart.write("ATF\r\n")
否则,可以完整接收字符串,效果如下图

uart = UART(3,9600)
改为uart = UART(3,9600, timeout=1000)
因为获取图片那个语句有几十毫秒的延时,正好让数据飞一会~