diff options
Diffstat (limited to 'docs/zephyr')
| -rw-r--r-- | docs/zephyr/quickref.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/zephyr/quickref.rst b/docs/zephyr/quickref.rst index 63d4bced0..a7ae69860 100644 --- a/docs/zephyr/quickref.rst +++ b/docs/zephyr/quickref.rst @@ -56,6 +56,21 @@ Use the :ref:`machine.Pin <machine.Pin>` class:: switch = Pin(("gpioc", 6), Pin.IN) # create input pin for a switch switch.irq(lambda t: print("SW2 changed")) # enable an interrupt when switch state is changed +PWM +--- + +Use the :ref:`machine.PWM <machine.PWM>` class:: + + from machine import PWM + + pwm = PWM(("pwm0", 0), freq=3921568, duty_ns=200, invert=True) # create pwm on PWM0 + print(pwm) # print pwm + + print(pwm.duty_ns()) # print pwm duty cycle in nanoseconds + pwm.duty_ns(255) # set new pwm duty cycle in nanoseconds + + pwm.deinit() + Hardware I2C bus ---------------- |
