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



    • import sensor, image, time, math
      from pyb import UART
      
      uart = UART(3,4800, timeout_char=1000)                         # i使用给定波特率初始化
      uart.init(4800, bits=8, parity=None, stop=1, timeout_char=1000) # 使用给定参数初始化
      GRAYSCALE_THRESHOLD = [(0, 64)]
      ROIS = [ # [ROI, weight]
              (0, 0, 0, 0, 0), # You'll need to tweak the weights for your app
              (0, 50, 320, 30, 0.3), # depending on how your robot is setup.
              (0, 0, 0, 0, 0)
             ]
      
      weight_sum = 0
      for r in ROIS: weight_sum += r[4]
      
      
      sensor.reset() # Initialize the camera sensor.
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      sensor.set_pixformat(sensor.GRAYSCALE) # use grayscale.
      sensor.set_framesize(sensor.VGA) # use QQVGA for speed.
      sensor.set_windowing((320, 240))
      sensor.skip_frames(time = 2000) # Let new settings take affect.
      sensor.set_auto_gain(False,value=100) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock() # Tracks FPS.
      
      a=0
      def draw_keypoints(img, kpts):
          if kpts:
              print(kpts)
              img.draw_keypoints(kpts)
              img = sensor.snapshot()
              time.sleep(1000)
      kpts1 = image.load_descriptor("/desc.orb")
      img = sensor.snapshot()
      
      def high(x):
          x=x>>8
          return x
      
      def low(x):
          x=x&0xff
          return x
      
      while(True):
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot() # Take a picture and return the image.
          print(0)
          if uart.any():
              a=uart.read(1)
              print(a)
          if a==1:
                   print(2)
          if a==2:
                   print(3)


    • https://singtown.com/learn/50240/
      看一下视频,b'1'是字节串bytes,不是字符串string,也不是数字int。