import machine
pwm = machine.PWM(machine.Pin(15))
pwm.freq(1000) # 1 kHz
duty_cycle = 32768 # 50% duty cycle
pwm.duty_u16(duty_cycle)
while True:
pass # Do nothing, duty cycle remains constantimport machine
pwm = machine.PWM(machine.Pin(15))
pwm.freq(1000) # 1 kHz
duty_cycle = 32768 # 50% duty cycle
pwm.duty_u16(duty_cycle)
while True:
pass # Do nothing, duty cycle remains constant