summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp32
diff options
context:
space:
mode:
authorIhorNehrutsa <ihor.nehrutsa@gmail.com>2025-03-13 13:46:46 +0200
committerDamien George <damien@micropython.org>2025-05-16 12:37:25 +1000
commit9d565182d757e7a9bdf95bcb2b18fe2d6fa4111a (patch)
tree49b7a44346f6e9e8bf311a80e01519153cbc6c7c /docs/esp32
parenta72454519362dd1de5eff9e2eb268e6ea1040a40 (diff)
downloadmicropython-9d565182d757e7a9bdf95bcb2b18fe2d6fa4111a.tar.gz
micropython-9d565182d757e7a9bdf95bcb2b18fe2d6fa4111a.zip
docs/esp32/quickref: Add PWM lightsleep example.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Diffstat (limited to 'docs/esp32')
-rw-r--r--docs/esp32/quickref.rst5
1 files changed, 4 insertions, 1 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst
index 707ae27c08..56d8b0e4f6 100644
--- a/docs/esp32/quickref.rst
+++ b/docs/esp32/quickref.rst
@@ -383,7 +383,7 @@ for more details.
Use the :ref:`machine.PWM <machine.PWM>` class::
- from machine import Pin, PWM
+ from machine import Pin, PWM, lightsleep
pwm0 = PWM(Pin(0), freq=5000, duty_u16=32768) # create PWM object from a pin
freq = pwm0.freq() # get current frequency
@@ -409,6 +409,9 @@ Use the :ref:`machine.PWM <machine.PWM>` class::
pwm4 = PWM(Pin(4), lightsleep=True) # Allow PWM during light sleep mode
+ lightsleep(10*1000) # pwm0, pwm2 goes off, pwm4 stays on during 10s light sleep
+ # pwm0, pwm2, pwm4 on after 10s light sleep
+
ESP chips have different hardware peripherals:
======================================================= ======== ========= ==========