# (Practice 2) Controlling LEDs with a Button

{% hint style="success" %}
The default button built into the HUENIT AI camera returns a value of 0 when pressed, and a value of 1 when not pressed.
{% endhint %}

{% hint style="info" %}
*(*(Practice 2) To control LEDs with a button, you need to understand the concepts of \[Conditional Statements] and \[Infinite Loops].
{% endhint %}

### Example Code

**(Example) When the button is pressed, turn on LED 20 with R: 250, G: 100, B: 100.**

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FeDMlkqKAPm2yhFfp37rO%2Fimage.png?alt=media&#x26;token=6e108c12-e0d0-440f-96cd-337a0b2b9038" alt=""><figcaption></figcaption></figure>

***

### :bell: **Block Description**

#### 1. \[Infinite Loop]

A block that repeats the desired block infinitely.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2Fz16JSkyjRRAWkIzdOAY8%2Fimage.png?alt=media&#x26;token=2bc27e3f-92dd-488c-b378-c66e69d8e85d" alt=""><figcaption></figcaption></figure>
