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



    • 0_1557582437842_错误.png

      # UART Control
      #
      # This example shows how to use the serial port on your OpenMV Cam. Attach pin
      # P4 to the serial input of a serial LCD screen to see "Hello World!" printed
      # on the serial LCD display.
      
      import time
      from pyb import UART
      import sensor, image, time
      from pyb import UART
      import json
      import pyb
      threshold_index = 0 # 0 for red, 1 for green, 2 for blue
      
      thresholds = [(5, 100, 30, 127, 0, 80), # generic_red_thresholds
                    (5, 100, -127, -20, 0, 80), # generic_green_thresholds
                    (5, 100, -20, 30, -127, -20)] # generic_blue_thresholds
      led = pyb.LED(3)
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      # Always pass UART 3 for the UART number for your OpenMV Cam.
      # The second argument is the UART baud rate. For a more advanced UART control
      # example see the BLE-Shield driver.
      uart = UART(3, 115200)
      
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      
      uart = UART(3, 115200)
      flag = 0
      cnt = 0
      x = 0
      y = 0
      
      while(True):
          #output = "%d"%(3)
          #uart.write(output)
          clock.tick()
      
          if uart.any():
            a = uart.readline().decode().strip()
            print(a)
            flag = int(a)
            print(flag)
          if flag == 1:
            img = sensor.snapshot().lens_corr(1.8)
      
         # uart.write("Hello World!\r")
         # time.sleep(100)
      发送的数据为 1 或者 2
      单片机端代码
               sprintf(printbuff1, "1\r\n");                  //显示
               uart_putstr(UART1,printbuff1);
      

      会出现图中的错误,怎么解决呢



    • 你应该用串口助手试一下,我不知道你单片机的函数有没有混进去什么奇怪的东西。