• OpenMV VSCode 扩展发布了,在插件市场直接搜索OpenMV就可以安装
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 连接延长线为什么会报错,不使用延长线是可以正常使用的



    • 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()
      
      

      0_1650008461030_fe49adf2-abb0-4b49-8d30-6c4897cc6144-image.png
      0_1650008481173_72763873-3460-4d0b-a94b-d37cadbf19c2-image.png



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



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