Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you may not be able to execute some actions.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
PWM占空比只能是整数。
如果我想输出一个周期20ms,0.5ms高电平的PWM怎么做呢?
import time from pyb import Pin, Timer tim = Timer(4, freq=50) ch1 = tim.channel(1, Timer.PWM, pin=Pin("P7")) pulse_width = int(tim.period()*0.125) ch1.pulse_width(pulse_width) while (True): time.sleep_ms(1000)