PWM
class PWM – Pulse Width Modulation
Quick Usage Example
from machine import PWM
pwm = PWM(0, frequency=5000) # use PWM timer 0, with a frequency of 5KHz
# create pwm channel on pin P12 with a duty cycle of 50%
pwm_c = pwm.channel(0, pin='P12', duty_cycle=0.5)
pwm_c.duty_cycle(0.3) # change the duty cycle to 30%Constructors
class machine.PWM(timer, frequency)
Methods
pwm.channel(id, pin * , duty_cycle=0.5)
class PWMChannel — PWM channel
Methods
pwmchannel.duty_cycle(value)
Last updated