duty_u16 ( 0 ) # stop the output at channel A print ( pwm0 ) # show the properties of the PWM object. duty_u16 ( 200 ) # set the duty cycle of channel A, range 0-65535 pwm0. duty_u16 () # get the current duty cycle of channel A, range 0-65535 pwm0. freq ( 1000 ) # set/change the frequency of slice 0 pwm0. freq () # get the current frequency of slice 0 pwm0. From machine import Pin, PWM # create PWM object from a pin and set the frequency of slice 0 # and duty cycle for channel A pwm0 = PWM ( Pin ( 0 ), freq = 2000, duty_u16 = 32768 ) pwm0.
0 Comments
Leave a Reply. |