logo

云台上下可以动,左右不能动,示波器显示有PWM波

2020-10-03 11:32
C
k2ce
# 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
#from pyb import Pin, Timer
tim = pyb.Timer(4, freq=50)
chA = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"))#
chB = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"))

times = 500
while (times >1):
    chA.pulse_width_percent(40)#
    chB.pulse_width_percent(30)#
    times = times - 1
    pyb.delay(10)

chA.pulse_width_percent(0)#向前
chB.pulse_width_percent(0)#
2020-10-04 18:03
I
网红小智智 星瞳科技

https://singtown.com/learn/49603/

云台按照这个视频操作。

https://singtown.com/learn/50541/

舵机按照这个视频测试。