星瞳实验室APP,快速收到回复
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 使用串口发送TypeError: object with buffer protocol required



    • import sensor, image, time
      
      import time
      from pyb import UART
      
      thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
                    (30, 100, -64, -8, -32, 32), # generic_green_thresholds
                    (0, 15, 0, 40, -80, -20)] # generic_blue_thresholds
      
      uart = UART(3, 9600)
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must turn this off to prevent image washout...
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
          for code in img.find_qrcodes():
              uart.write(code.payload())
          for blob in img.find_blobs(thresholds, pixels_threshold=200, area_threshold=200):
                  img.draw_rectangle(blob.rect())
                  img.draw_cross(blob.cx(), blob.cy())
                  uart.write(blob[8])
      
      


    • 求大佬解答下,哭了



    • 数据需要是字符串。
      来自星瞳实验室APP: OpenMV串口发送数据 https://singtown.com/learn/50235/



    • @kidswong999 哦哦哦这样啊,谢谢大佬