Skip to content

Commit 9d56518

Browse files
IhorNehrutsadpgeorge
authored andcommitted
docs/esp32/quickref: Add PWM lightsleep example.
Signed-off-by: Ihor Nehrutsa <[email protected]>
1 parent a724545 commit 9d56518

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)