zephyr/samples/basic/fade_led
Yishai Jaffe 3b45feeb8b samples: fade_led: add direction per LED
Fixed a bug where that was caused because the different LEDs use the
same 'dir' variable and that caused them to eventually lose
synchronization.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-06-30 15:16:37 -05:00
..
boards samples: fade_led: fix no led found error on rpi pico 2025-06-20 16:25:10 +02:00
src samples: fade_led: add direction per LED 2025-06-30 15:16:37 -05:00
sysbuild/vpr_launcher
CMakeLists.txt
prj.conf
README.rst doc: boards: nordic: Adopt zephyr:board directives 2025-03-31 22:00:02 +02:00
sample.yaml

.. zephyr:code-sample:: fade-led
   :name: Fade LED
   :relevant-api: pwm_interface

   Fade an LED using the PWM API.

Overview
********

This application "fades" a LED using the :ref:`PWM API <pwm_api>`.

The LED starts off increases its brightness until it is fully or nearly fully
on. The brightness then decreases until the LED is off, completing on fade
cycle. Each cycle takes 2.5 seconds, and the cycles repeat forever. The PWM
period is taken from Devicetree. It should be fast enough to be above the
flicker fusion threshold.

Requirements and Wiring
***********************

This sample has the same requirements and wiring considerations as the
:zephyr:code-sample:`pwm-blinky` sample.

Building and Running
********************

To build and flash this sample for the :zephyr:board:`nrf52840dk`:

.. zephyr-app-commands::
   :zephyr-app: samples/basic/fade_led
   :board: nrf52840dk/nrf52840
   :goals: build flash
   :compact:

Change ``nrf52840dk/nrf52840`` appropriately for other supported boards.

After flashing, the sample starts fading the LED as described above. It also
prints information to the board's console.