> For the complete documentation index, see [llms.txt](https://huenit.gitbook.io/huenit-edu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://huenit.gitbook.io/huenit-edu/huenit/huenit-lab/4./4.1-ai/3.1.1.-led/2-2-led-_.md).

# (예제2-2) 원하는 모양으로 LED 제어하기\_심화

{% hint style="info" %}
***(예제2-2) 원하는 모양으로 LED제어하기- 심화*** 를 하기 위해서는 **`[Lists], [반복문]`** 개념에 대해서 알아야 합니다.
{% endhint %}

### 예시코드

#### (예시) 하트모양으로 LED 켜기 (R:25, G:15, B:15)

<figure><img src="/files/1YDht52hzfbippp422GD" alt=""><figcaption><p>하트모양 LED 번호</p></figcaption></figure>

(1-1) 전체 LED를 heart변수에 저장하는 경우

* heart **`[변수]`**&#xB97C; 생성하여, 하트모양에 필요한 LED 번호를 **`[리스트]`**&#xB85C; 생성하여 선언한다.&#x20;
* **`[목록반복]`**  블록을 사용하여 LED 색상을 설정해 준다.&#x20;

<figure><img src="/files/y0kmjpp70xf4stuHI6Lw" alt=""><figcaption></figcaption></figure>

(1-2) 왼쪽 하트모양에 필요한 LED 번호를 저장하는 경우

* heart **`[변수]`**&#xB97C; 생성하여,  왼쪽하트모양에 필요한 LED 번호를 **`[리스트]`**&#xB85C; 생성하여 선언한다.&#x20;
* **`[목록반복]`**  블록을 사용하여 LED 색상을 설정해 준다.&#x20;
* 왼쪽 LED와 오른쪽 LED를 같은 모양으로 설정하기 위해서는 **`왼쪽 LED번호 + 25`** 한 위치의 LED를 원하는 색상으로 설정해준다.&#x20;

<figure><img src="/files/V7AH3tvMLcNalsK2weMn" alt=""><figcaption></figcaption></figure>
