导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 4lme
    4
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    4lme

    @4lme

    0
    声望
    1
    楼层
    207
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    4lme 关注

    4lme 发布的帖子

    • 用串口向32发信息,32代码都没问题,但是串口一直发不出去,一点反应没有,波特率都是对的,代码有问题吗?

      import sensor, image, time
      from machine import UART
      import json

      red_threshold = (100, 34, 11, 127, -28, 54)

      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.RGB565) # use RGB565.
      sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
      sensor.skip_frames(10) # Let new settings take affect.
      sensor.set_auto_whitebal(False) # turn this off.
      clock = time.clock() # Tracks FPS.

      uart = UART(1,115200)
      uart.init(115200, bits=8, parity=None, stop=1)
      def find_max(blobs):
      max_size=0
      for blob in blobs:
      if blob[2]*blob[3] > max_size:
      max_blob=blob
      max_size = blob[2]*blob[3]
      return max_blob

      while(True):
      img = sensor.snapshot() # Take a picture and return the image.
      blobs = img.find_blobs([red_threshold])
      if blobs:
      max_blob = find_max(blobs)
      x_error = max_blob[5]-img.width()/2
      y_error = max_blob[6]-img.height()/2
      img.draw_rectangle(max_blob[0:4]) # rect
      img.draw_cross(max_blob[5], max_blob[6]) # cx, cy
      output_str="%d,%d"% (x_error,y_error) #方式1
      uart.write(output_str+'\r\n')
      print('you send:',output_str)

      发布在 OpenMV Cam
      4
      4lme