samples/basic/rgb_led/README.html · samples/basic/rgb_led/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · PWM

PWM RGB LED

빨강·초록·파랑 pulse width를 순서대로 변화시켜 RGB 색상 변화를 계속 만듭니다.

Official pathsamples/basic/rgb_led/README.html
Source filesamples/basic/rgb_led/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

세 Devicetree alias, 지원하지 않는 board의 오류, Hexiwear build·flash 절차를 설명합니다.

Channels

Red · Green · Blue

Aliases

red/green/blue-pwm-led

Board

hexiwear/mk64f12

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 1BB11DB75C4E077E11048A95942552F93BC24F5BC650A2260E85ABB9C66FA922
.. zephyr:code-sample:: rgb-led
   :name: PWM RGB LED
   :relevant-api: pwm_interface

   Drive an RGB LED using the PWM API.

Overview
********

This is a sample app which drives an RGB LED using the :ref:`PWM API <pwm_api>`.

There are three single-color component LEDs in an RGB LED. Each component LED
is driven by a PWM port where the pulse width is changed from zero to the period
indicated in Devicetree. Such period should be fast enough to be above the
flicker fusion threshold (the minimum flicker rate where the LED is perceived as
being steady). The sample causes each LED component to step from dark to max
brightness. Three **for** loops (one for each component LED) generate a gradual
range of color changes from the RGB LED, and the sample repeats forever.

Requirements
************

The board must have red, green, and blue LEDs connected via PWM output channels.

The LED PWM channels must be configured using the following :ref:`devicetree
<dt-guide>` aliases, usually in the :ref:`BOARD.dts file
<devicetree-in-out-files>`:

- ``red-pwm-led``
- ``green-pwm-led``
- ``blue-pwm-led``

You will see at least one of these errors if you try to build this sample for
an unsupported board:

.. code-block:: none

   Unsupported board: red-pwm-led devicetree alias is not defined
   Unsupported board: green-pwm-led devicetree alias is not defined
   Unsupported board: blue-pwm-led devicetree alias is not defined

See :zephyr_file:`boards/nxp/hexiwear/hexiwear_mk64f12.dts` for an example
:file:`BOARD.dts` file which supports this sample.

Wiring
******

No additional wiring is necessary if the required devicetree aliases refer to
hardware that is already connected to LEDs on the board.

Otherwise, LEDs should be connected to the appropriate PWM channels.

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

For example, to build and flash this board for :ref:`hexiwear`:

.. zephyr-app-commands::
   :zephyr-app: samples/basic/rgb_led
   :board: hexiwear/mk64f12
   :goals: build flash
   :compact:

Change ``hexiwear/mk64f12`` appropriately for other supported boards.

Part 3

한국어 전문 번역

개요

이 sample application은 PWM API를 사용해 RGB LED를 구동합니다.

RGB LED 안에는 빨강, 초록, 파랑의 단색 component LED 세 개가 있습니다. 각 component LED는 PWM port 하나로 구동되며, pulse width는 0에서 Devicetree에 지정된 period까지 변합니다. 이 period는 LED가 계속 켜진 것처럼 보이는 최소 깜박임 속도인 깜박임 융합 임계값(flicker fusion threshold)보다 충분히 빨라야 합니다.

Sample은 각 LED component의 밝기를 꺼진 상태에서 최대 밝기까지 단계적으로 높입니다. Component LED마다 하나씩 있는 세 개의 for loop가 RGB LED의 색상을 점진적으로 변화시키며, 이 동작을 끝없이 반복합니다.

요구사항

Board에는 PWM output channel을 통해 연결된 빨강, 초록, 파랑 LED가 있어야 합니다.

LED PWM channel은 보통 BOARD.dts file에서 다음 Devicetree alias로 configuration해야 합니다.

  • red-pwm-led
  • green-pwm-led
  • blue-pwm-led

지원하지 않는 board에서 이 sample을 build하면 다음 오류 중 하나 이상이 나타납니다.

Unsupported board: red-pwm-led devicetree alias is not defined
Unsupported board: green-pwm-led devicetree alias is not defined
Unsupported board: blue-pwm-led devicetree alias is not defined

이 sample을 지원하는 BOARD.dts 예제는 boards/nxp/hexiwear/hexiwear_mk64f12.dts를 참조하십시오.

배선

필요한 Devicetree alias가 board에 이미 연결된 LED hardware를 가리키면 추가 배선은 필요하지 않습니다.

그렇지 않으면 LED를 알맞은 PWM channel에 연결해야 합니다.

Build와 실행

예를 들어 hexiwear board용으로 build하고 flash하려면 다음 명령을 실행합니다.

west build -b hexiwear/mk64f12 samples/basic/rgb_led
west flash

다른 지원 board를 사용하려면 hexiwear/mk64f12를 해당 board 이름으로 바꾸십시오.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.