# (Practice 2-2) Controlling LEDs in Desired Shapes\_Advanced ver

{% hint style="info" %}
(Practice 2-2) To control LEDs in the desired shapes - Advanced, you need to understand the concepts of \[Lists] and \[Loops].
{% endhint %}

### Example Code

(Example) Turning on LED in Heart Shape (R:250, G:150, B:150)

<figure><img src="https://content.gitbook.com/content/auX5vWu2xzL5b4Cvif21/blobs/LiBamNFDG5I2d8xTOXq8/image.png" alt=""><figcaption><p>하트모양 LED 번호</p></figcaption></figure>

**(1-1) When Storing All LEDs in the heart Variable**

* Create a heart \[variable] and declare a \[list] with the LED numbers required for the heart shape.
* Use the \[Repeat List] block to set the LED colors.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FAIWa7cVWer1fecwGeNcW%2Fimage.png?alt=media&#x26;token=c50f2f55-c9e5-4cb4-adbb-3b0c0d0b2b17" alt=""><figcaption></figcaption></figure>

**(1-2) When Storing LED Numbers Required for the Left Heart Shape**

* Create a heart \[variable] and declare a \[list] with the LED numbers required for the left heart shape.
* Use the \[Repeat List] block to set the LED colors.
* To set the left and right LEDs in the same shape, set the LED at the position of the left LED number + 25 to the desired color.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2Fgqkws5gyvq8Pt9KlvBvz%2Fimage.png?alt=media&#x26;token=00643ff4-5270-43e0-81c8-441e9d9df986" alt=""><figcaption></figcaption></figure>
