zephyr/samples/drivers/led/pwm
TOKITA Hiroshi 230280e0e9 boards: arduino: uno_r4: Add ADC, PWM, I2C, SPI, and TRNG
Add support for basic peripherals.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-21 09:51:47 +01:00
..
boards boards: arduino: uno_r4: Add ADC, PWM, I2C, SPI, and TRNG 2025-03-21 09:51:47 +01:00
src samples: led: pwm: add decreasing brightness logic 2024-12-17 09:48:40 +01:00
CMakeLists.txt
Kconfig samples: drivers: led: pwm: Makes blink and fade times configurable 2024-10-10 10:07:47 +02:00
prj.conf
README.rst samples: led: pwm: add decreasing brightness logic 2024-12-17 09:48:40 +01:00
sample.yaml tests/samples: use integration platforms where possible 2025-03-11 11:35:15 +01:00

.. zephyr:code-sample:: led-pwm
   :name: LED PWM
   :relevant-api: led_interface

   Control PWM LEDs using the LED API.

Overview
********

This sample allows to test the led-pwm driver. The first "pwm-leds" compatible
device instance found in DT is used. For each LEDs attached to this device
(child nodes) the same test pattern (described below) is executed. The LED API
functions are used to control the LEDs.

Test pattern
============

For each PWM LEDs (one after the other):

- Turning on
- Turning off
- Increasing brightness gradually
- Decreasing brightness gradually
- Blinking on: 0.1 sec, off: 0.1 sec
- Blinking on: 1 sec, off: 1 sec
- Turning off

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

This sample can be built and executed on all the boards with PWM LEDs connected.
The LEDs must be correctly described in the DTS: the compatible property of the
device node must match "pwm-leds". And for each LED, a child node must be
defined and the PWM configuration must be provided through a "pwms" phandle's
node.