import sensor, image, time, math
from pyb import UART
uart = UART(3, 9600, timeout_char=1000)
sensor.reset()
sensor.set_vflip(True)
sensor.set_hmirror(True)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQQVGA)
sensor.skip_frames(time = 100)
clock = time.clock()
THRESHOLD = (3, 37, -22, 20, -40, 19)
while(True):
img = sensor.snapshot().binary([THRESHOLD]).dilate(5).erode(8)
uart.write("KR-0,50,0;")
我运行这个代码没有出现问题。
不是代码的问题,找一找其他的问题。