pulseio module contains classes to provide access to basic pulse IO.
This module is not available in some SAMD21 builds. See the Support Matrix for more info.
All classes change hardware state and should be deinitialized when they
are no longer needed if the program continues after use. To do so, either
deinit() or use a context manager. See
Lifetime and ContextManagers for more info.
import pulseio import time from board import * pwm = pulseio.PWMOut(D13) pwm.duty_cycle = 2 ** 15 time.sleep(0.1)
This example will initialize the the device, set
duty_cycle, and then sleep 0.1 seconds.
CircuitPython will automatically turn off the PWM when it resets all
hardware after program completion. Use
deinit() or a
to do it yourself.