8000 docs/esp32/quickref.rst: Add lightsleep() example. · micropython/micropython@850146e · GitHub
[go: up one dir, main page]

Skip to content

Commit 850146e

Browse files
committed
docs/esp32/quickref.rst: Add lightsleep() example.
docs/esp32/quickref.rst: Add lightsleep() PWM example. Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
1 parent 9ea0573 commit 850146e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/esp32/quickref.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ for more details.
383383

384384
Use the :ref:`machine.PWM <machine.PWM>` class::
385385

386-
from machine import Pin, PWM
386+
from machine import Pin, PWM, lightsleep
387387

388388
pwm0 = PWM(Pin(0), freq=5000, duty_u16=32768) # create PWM object from a pin
389389
freq = pwm0.freq() # get current frequency
@@ -409,6 +409,9 @@ Use the :ref:`machine.PWM <machine.PWM>` class::
409409

410410
pwm4 = PWM(Pin(4), lightsleep=True) # Allow PWM during light sleep mode
411411

412+
lightsleep(10*1000) # pwm0, pwm2 goes off, pwm4 stays on during 10s light sleep
413+
# pwm0, pwm2, pwm4 on after 10s light sleep
414+
412415
ESP chips have different hardware peripherals:
413416

414417
======================================================= ======== ========= ==========

0 commit comments

Comments
 (0)
0