import pyb
p = pyb.Pin('P7') # P7 has TIM4, CH1
tim = pyb.Timer(4, freq=1000)
ch = tim.channel(1, pyb.Timer.PWM, pin=p)
ch.pulse_width_percent(50)
H
htak 发布的帖子
-
使用pwm的时候串口终端输出版本号然后无法运行是怎么回事?要怎么解决?
import pyb
p = pyb.Pin('P7') # P7 has TIM4, CH1
tim = pyb.Timer(4, freq=1000)
ch = tim.channel(1, pyb.Timer.PWM, pin=p)
ch.pulse_width_percent(50)