import sensor image time pyb
from pyb import UART
red = (47 68 55 103 25 63)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
clock = time.clock()
uart = UART(4 9600)
uart.write(‘hello‘)
def find_max(blobs):
max_size=0
for blob in blobs:
if blob.pixels() > max_size:
max_blob=blob
max_size = blob.pixels()
return max_blob
a = 0
b = 0
led = pyb.LED(1)
led.on()
while(True):
a = a+1
if a>20:
a = 0
led.off()
if a<1:
led = pyb.LED(2)
led.on()
if 2 led.off()
clock.tick()
img = sensor.snapshot()
blobs = im
评论
共有 条评论