Navigation

    • Login
    • Search
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. Home
    2. dnl1
    D
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    dnl1

    @dnl1

    0
    Reputation
    1
    Posts
    8
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    dnl1 Follow

    Posts made by dnl1

    • 使用测距模块频繁在运行中出现错误,整体代码没有错误能够运行,只在运行过程中报错,引脚接触良好,供电足够,报错信息如下
      Traceback (most recent call last):
        File "<stdin>", line 42, in test1
        File "vl53l1x.py", line 128, in read
      OSError: [Errno 19] ENODEV
      

      初始化代码如下:

      THRESHOLD = (19, 56, 19, 127, 4, 127)
      import sensor, image, time,pyb
      import IR
      from machine import I2C
      from vl53l1x import VL53L1X
      from pyb import UART
      from pyb import LED
      from pid import PID
      from pyb import Pin
      import car
      import _thread
      
      rho_pid = PID(p=1.1, i=0) #偏移距离PID
      theta_pid = PID(p=0.8, i=0)#偏移角度PID
      
      i2c = I2C(2)
      distance = VL53L1X(i2c)
      
      uart = UART(1,115200)
      uart.init(115200, bits=8, parity=None, stop=1)
      
      L =0
      Information = [00,00,00,00,00] #[模式,速度,红外运动类型,遇障停止信号]
      tem =0
      
      #LED(1).on()
      #LED(2).on()
      #LED(3).on()
      
      sensor.reset()
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      #sensor.set_windowing([0,20,80,40])
      sensor.skip_frames(time = 2000)     #等待2000ms让摄像头启动
      clock = time.clock()                #创建一个时钟来追踪FPS(每秒拍摄帧数)
      
      #线程1
      def test1(*args, **kwargs):
          while True: 
              pyb.delay(70) # 延时 50 毫秒
              L = distance.read() #测距传感器
              if(L<150):
                  Information[4]=0
                  print("mm:",L)
              else:
                  Information[4]=1
      
      
      thread_1 = _thread.start_new_thread(test1, (1,)) #创建线程
      
      posted in OpenMV Cam
      D
      dnl1