导航

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

    h5pr

    @h5pr

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

    h5pr 关注

    h5pr 发布的帖子

    • 串口接收和摄像头冲突

      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);
      

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

      发布在 OpenMV Cam
      H
      h5pr