• 星瞳AI VISION软件内测!可以离线标注,训练,并生成OpenMV的模型。可以替代edge impulse https://forum.singtown.com/topic/8206
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 舵机拓展版接上电连上这两个电机,使用示例程序测试只有中间的电机正常动红色圈的那边电机没反应,然后电机对调重复测试结果相同



    • 0_1g



    • 用的什么代码。发一下具体的代码文本。



    • # Motor Shield PWM Example
      #
      # This example shows off how to control the motor shield on your
      # OpenMV Cam. The motor shield is controlled by using the PYB module
      # which lets you do PWM to control the speed and set digital I/O pin
      # states. The motor shield needs 6 I/O pins for both motors.
      
      import pyb
      
      # These pins control our direction while the other PWN pins
      # below control the speed. The direction for each motor
      # is set by an H-Bridge where A0/1 are the two sides of
      # one H-Bridge driver. B0/1 are another H-Bridge.
      pinADir0 = pyb.Pin('P3', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinADir1 = pyb.Pin('P2', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinBDir0 = pyb.Pin('P1', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinBDir1 = pyb.Pin('P0', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      
      # Dir0/1 must be not equal to each other for forward or backwards
      # operation. If they are equal then that's a brake operation.
      # If they are not equal then the motor will spin one way other the
      # other depending on it's hookup and the value of dir 0.
      pinADir0.value(0)
      pinADir1.value(1)
      
      # Dir0/1 must be not equal to each other for forward or backwards
      # operation. If they are equal then that's a brake operation.
      # If they are not equal then the motor will spin one way other the
      # other depending on it's hookup and the value of dir 0.
      pinBDir0.value(0)
      pinBDir1.value(1)
      
      # Create a timer object running at 1KHz which which will power the
      # PWM output on our OpenMV Cam. Just needs to be created once.
      tim = pyb.Timer(4, freq=1000)
      
      # Use the timer object to create two PWM outputs on the OpenMV Cam.
      # These timers control the speed of the motors. You will be setting
      # the PWM percentage of these timers repeatedly in your loop.
      chA = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"))
      chB = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"))
      
      while (True):
      
          for i in range(100):
              pyb.delay(100)
              chA.pulse_width_percent(i)
              chB.pulse_width_percent(99-i)
      
          for i in range(100):
              pyb.delay(100)
              chA.pulse_width_percent(99-i)
              chB.pulse_width_percent(i)
      


    • @kidswong999

      # Motor Shield PWM Example
      #
      # This example shows off how to control the motor shield on your
      # OpenMV Cam. The motor shield is controlled by using the PYB module
      # which lets you do PWM to control the speed and set digital I/O pin
      # states. The motor shield needs 6 I/O pins for both motors.
      
      import pyb
      
      # These pins control our direction while the other PWN pins
      # below control the speed. The direction for each motor
      # is set by an H-Bridge where A0/1 are the two sides of
      # one H-Bridge driver. B0/1 are another H-Bridge.
      pinADir0 = pyb.Pin('P3', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinADir1 = pyb.Pin('P2', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinBDir0 = pyb.Pin('P1', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      pinBDir1 = pyb.Pin('P0', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
      
      # Dir0/1 must be not equal to each other for forward or backwards
      # operation. If they are equal then that's a brake operation.
      # If they are not equal then the motor will spin one way other the
      # other depending on it's hookup and the value of dir 0.
      pinADir0.value(0)
      pinADir1.value(1)
      
      # Dir0/1 must be not equal to each other for forward or backwards
      # operation. If they are equal then that's a brake operation.
      # If they are not equal then the motor will spin one way other the
      # other depending on it's hookup and the value of dir 0.
      pinBDir0.value(0)
      pinBDir1.value(1)
      
      # Create a timer object running at 1KHz which which will power the
      # PWM output on our OpenMV Cam. Just needs to be created once.
      tim = pyb.Timer(4, freq=1000)
      
      # Use the timer object to create two PWM outputs on the OpenMV Cam.
      # These timers control the speed of the motors. You will be setting
      # the PWM percentage of these timers repeatedly in your loop.
      chA = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"))
      chB = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"))
      
      while (True):
      
          for i in range(100):
              pyb.delay(100)
              chA.pulse_width_percent(i)
              chB.pulse_width_percent(99-i)
      
          for i in range(100):
              pyb.delay(100)
              chA.pulse_width_percent(99-i)
              chB.pulse_width_percent(i)
      


    • 估计是你OpenMV焊接的不对,联系售后检查维修。