PWM¶
Overview¶
The PWM sample demonstrates using the pwmio
module to fade the Green LED (alias LED0) on nRF52840 Connect Kit.
Requirements¶
Before you start, check that you have the required hardware and software:
- nRF52840 Connect Kit running the CircuitPython firmware
- 1x USB-C Cable
- Mu Editor
- A computer running macOS, Linux, or Windows 7 or newer
Running the code¶
To run the code, complete the following steps:
- Connect nRF52840 Connect Kit to your computer using the USB-C Cable.
- Start Mu Editor, click Load to open
code.py
in the CIRCUITPY drive. -
Copy and paste the following code into
code.py
and click Save: -
Your code will run as soon as the file is done saving. Observe that the Green LED starts off increases its brightness until it is fully on and then decreases until the LED is off, completing on fade cycle.