# (Practice 1) Checking Button Values

{% hint style="info" %}
(Practice 1) To check the button values, you need to understand the concepts of \[Serial Monitor] and \[Infinite Loop].
{% endhint %}

### Example Code

**(Example) Checking Button Values through the Serial Monitor**

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2Fo6ZeOo4G438AZutaPui0%2Fimage.png?alt=media&#x26;token=92ba32d0-85e2-4c81-a8f0-9c42bacfb480" alt=""><figcaption></figcaption></figure>

**(Result)**

* \[When the button is pressed]: 0
* \[When the button is not pressed]: 1

***

### :bell: **Block Explanation**

1. **\[Print (Enter text input \[] ) to serial monitor] Block**

* This block is used to output a desired string or value to the serial monitor.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FA58x4izErSHyCfCSX2w2%2Fimage.png?alt=media&#x26;token=03296f8b-3837-42e9-8c1f-41f0f480c0f8" alt=""><figcaption><p>[Print (Enter text input [] ) to serial monitor] Block</p></figcaption></figure>

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2F6Y692YPNdTGDR0BWtPH9%2Fimage.png?alt=media&#x26;token=f9928bbd-a968-42d0-bed2-7847c1b6b2e4" alt=""><figcaption><p>[Print ( ) to serial monitor] Block </p></figcaption></figure>

2. **\[Get Button's Value] Block**

* This block is used to read the current button status of the AI camera.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FdGSmZM8uK7Y5AjVoxfnl%2Fimage.png?alt=media&#x26;token=793a5043-094b-4171-98f4-7b8f644d2c27" alt="" width="241"><figcaption><p><strong>[Get Button's Value] Block</strong></p></figcaption></figure>

***

### **(Additional) How to Check Serial Monitor**

#### **How to Open the Serial Monitor**

You can open the Serial Monitor window by clicking the monitor icon at the bottom right.

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FcovKvnwUWIRkVwMnKohf%2Fimage.png?alt=media&#x26;token=81c7006a-0350-4521-aca1-098956cbcc6c" alt=""><figcaption></figcaption></figure>

When you open the window, you can see the current button value displayed every 0.5 seconds. (It shows 0 when the button is pressed, and 1 when it is not pressed.)

<figure><img src="https://1881188396-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FauX5vWu2xzL5b4Cvif21%2Fuploads%2FtxGNWJ9ntVfvtRD0acPb%2Fimage.png?alt=media&#x26;token=6218e675-721d-4e66-82f1-391a63080f04" alt=""><figcaption></figcaption></figure>
