summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp32
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2023-02-25 10:51:56 +0100
committerDamien George <damien@micropython.org>2023-05-04 13:15:55 +1000
commitdc8f9d22ca2ec9328b519e79013c97bbbe18b6c6 (patch)
treed4f5ce3e6f205e5b1c3dd541142395f3d60b0d1a /docs/esp32
parent84302b2854334371217015a5924978c009a94d30 (diff)
downloadmicropython-dc8f9d22ca2ec9328b519e79013c97bbbe18b6c6.tar.gz
micropython-dc8f9d22ca2ec9328b519e79013c97bbbe18b6c6.zip
docs: Update the PWM examples based on recent API improvements.
This adds the freq and duty_u16 keyword settings to the constructor, and sometimes other details in the PWM section. For mimxrt a clarification regarding the PWM invert argument was added, and for rp2 a few words were spent on PWM output pairs of a channel/slice.
Diffstat (limited to 'docs/esp32')
-rw-r--r--docs/esp32/quickref.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst
index f74926c374..e19c6ecb40 100644
--- a/docs/esp32/quickref.rst
+++ b/docs/esp32/quickref.rst
@@ -305,8 +305,8 @@ Use the :ref:`machine.PWM <machine.PWM>` class::
from machine import Pin, PWM
- pwm0 = PWM(Pin(0)) # create PWM object from a pin
- freq = pwm0.freq() # get current frequency (default 5kHz)
+ pwm0 = PWM(Pin(0), freq=5000, duty_u16=32768) # create PWM object from a pin
+ freq = pwm0.freq() # get current frequency
pwm0.freq(1000) # set PWM frequency from 1Hz to 40MHz
duty = pwm0.duty() # get current duty cycle, range 0-1023 (default 512, 50%)