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



    • 没发现和视频里的原代码有差别,但如果发送“123456”,得到数据不是一整行打印出来的,如果发送“123456\r\n”的话会报错

      # Select an area in the Framebuffer to copy the color settings.
      
      import time
      from machine import I2C
      #from vl53l1x import VL53L1X
      from pid import PID
      from pyb import UART
      import math
      clock = time.clock() # Tracks FPS.
      
      # For color tracking to work really well you should ideally be in a very, very,
      # very, controlled enviroment where the lighting is constant...
      
      '''
      i2c = I2C(2)
      distance = VL53L1X(i2c)
      '''
      x_pid = PID(p=0.5, i=1, imax=100)
      d_pid = PID(p=0.05, i=0.1, imax=50)
      
      uart1=UART(3,115200,timeout_char=1000)
      #uart2=UART(3, 115200)
      #uart2.init(115200, bits=8, parity=None, stop=1)
      
      while(True):
      #    clock.tick() # Track elapsed milliseconds between snapshots().
      
          
          if uart1.any():
              x_error=uart1.readline().decode().strip()
              
              print(x_error)
      

      0_1600868028311_0111.PNG



    • 用一下这个代码

      import time
      from pyb import UART
      
      # 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, 19200,timeout=1000)
      
      while(True):
          if uart.any():
              print(uart.readline())