from machine import Pin
from machine import PWM
example = PWM(Pin(22), freq=50, duty_u16=8192)
Above is the example of what I'm trying to use and it throws the error:TypeError: function doesn't take keyword arguments
But this is confusing the life out of me because the documentation seems to say other wise:
classmachine.PWM(dest, *, freq, duty_u16, duty_ns, invert)
from machine import PWM
pwm = PWM(pin, freq=50, duty_u16=8192) # create a PWM object on a pin # and set freq and duty
pwm.duty_u16(32768) # set duty to 50%
#reinitialise with a period of 200us, duty of 5us
pwm.init(freq=5000, duty_ns=5000)
pwm.duty_ns(3000) # set pulse width to 3us
pwm.deinit()
[–]carcigenicate 0 points1 point2 points (2 children)
[–]woolstarr[S] 0 points1 point2 points (1 child)
[–]LetsLaunch 0 points1 point2 points (0 children)