logo

连接延长线为什么会报错,不使用延长线是可以正常使用的

2022-04-15 15:41
B
澈泉
import sensor, image, time,pyb
from pyb import Pin
from pyb import LED
red_threshold   = (54, 65, 54, 79, 16, 48)
blue_threshold = (42, 65, 5, 48, -87, -33)
green_threshold = (44, 82, -54, 1, -6, 24)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(10)
sensor.set_auto_whitebal(False)
led1 = pyb.LED(1)
led2 = pyb.LED(2)
led3 = pyb.LED(3)
p3 = Pin('P0', Pin.OUT_PP)
p4 = Pin('P1', Pin.OUT_PP)
p5 = Pin('P2', Pin.OUT_PP)
p6 = Pin('P3', Pin.OUT_PP)
while(True):
    img = sensor.snapshot()
    blobs1 = img.find_blobs([red_threshold],roi=(270,5,150,250), pixels_threshold=150, area_threshold=200,merge=True)
    blobs2 = img.find_blobs([blue_threshold],roi=(270,5,150,250), pixels_threshold=150, area_threshold=200,merge=True)
    blobs3 = img.find_blobs([green_threshold],roi=(270,5,150,250),pixels_threshold=150, area_threshold=200,merge=True)
    img.lens_corr(1.8)
    for code in img.find_qrcodes():
        print(code)
        Data = code.payload()
        if Data == '357':
            i=0
            while(i<1000):
                p3.low()
                p4.low()
                p5.low()
                p6.high()
                i=i+1
                print(i)
        elif Data == '358':
            i=0
            while(i<1000):
                p3.low()
                p4.low()
                p5.high()
                p6.low()
                i=i+1
                print(i)
        elif Data == '367':
            i=0
            while(i<1000):
                p3.low()
                p4.low()
                p5.high()
                p6.high()
                i=i+1
                print(i)
        elif Data == '368':
            i=0
            while(i<1000):
                p3.low()
                p4.high()
                p5.low()
                p6.low()
                i=i+1
                print(i)
        elif Data == '457':
            i=0
            while(i<1000):
                p3.low()
                p4.high()
                p5.low()
                p6.high()
                i=i+1
                print(i)
        elif Data == '458':
            i=0
            while(i<1000):
                p3.low()
                p4.high()
                p5.high()
                p6.low()
                i=i+1
                print(i)
        elif Data == '467':
            i=0
            while(i<1000):
                p3.low()
                p4.high()
                p5.high()
                p6.high()
                i=i+1
                print(i)
        elif Data == '468':
            i=0
            while(i<1000):
                p3.high()
                p4.low()
                p5.low()
                p6.low()
                i=i+1
                print(i)
    if blobs1:
        for b in blobs1:
            img.draw_rectangle(b[0:4])
            print('red')
            led1.on()
            led2.off()
            led3.off()
            p3.high()
            p4.low()
            p5.low()
            p6.high()
    elif blobs2:
        for b in blobs2:
            img.draw_rectangle(b[0:4])
            print('blue')
            led1.off()
            led2.off()
            led3.on()
            p3.high()
            p4.low()
            p5.high()
            p6.low()
77b1c727-022a-4c73-81da-98a266ffea10.png
cff18cc0-a5fe-4ff7-96f6-04a742302178.png
2022-04-15 16:06
B
澈泉

固件与IDE也升级到最新版本,依然报错

2022-04-15 17:31
I
网红小智智 星瞳科技

建议把OpenMV和延长线都寄回检查维修。