导航

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

    3ksq

    @3ksq

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

    3ksq 关注

    3ksq 发布的帖子

    • RE: 电机和舵机是否能同时驱动?

      @kidswong999 openmv4 h7

      发布在 OpenMV Cam
      3
      3ksq
    • RE: 电机和舵机是否能同时驱动?

      比如说? 我改了好像有报错,只需要实现驱动一个功能0_1627893827290_OZZ$BL7{(_BKA8O{ZVPZ@13.png

      发布在 OpenMV Cam
      3
      3ksq
    • RE: 电机和舵机是否能同时驱动?

      舵机用p9 电机用p7 p8也不行吗?

      发布在 OpenMV Cam
      3
      3ksq
    • 电机和舵机是否能同时驱动?
      THRESHOLD = (40, 100, -128, 127, -128, 127) # Grayscale threshold for dark things...
      import sensor, image, time
      from pyb import LED, Servo
      from tb6612 import Motor
      
      servo3 = Servo(3)
      servo3.angle(0)
      m1 = Motor(1) # motor 1: A0 and A1
      #m2 = Motor(2) # motor 2: B0 and B1
      
      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.QQQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      #sensor.set_windowing([0,20,80,40])
      sensor.skip_frames(time = 2000)     # WARNING: If you use QQVGA it may take seconds
      clock = time.clock()                # to process a frame sometimes.
      
      while(True):
          clock.tick()
          m1.set_speed(10) # Forward
          #m2.set_speed(10) # Forward
          img = sensor.snapshot().binary([THRESHOLD])
          line = img.get_regression([(100,100)], robust = True)
          if (line):
              rho_err = abs(line.rho())-img.width()/2
              if line.theta()>90:
                  theta_err = line.theta()-180
              else:
                  theta_err = line.theta()
              img.draw_line(line.line(), color = 127)
              print(rho_err,line.magnitude(),theta_err)
              if line.magnitude()>8:
                  servo3.angle(0+theta_err)
      
      发布在 OpenMV Cam
      3
      3ksq