# BUTTON ユニット {docsify-ignore-all}

***
:memo:**[概要](#概要)** :octocat:**[サンプルコード](#サンプルコード)** :electric_plug:**[回路図](#回路図)** 🛒**[購入リンク](https://www.aliexpress.com/item/M5Stack-New-HMI-Unit-Kit-Including-4-Sensor-Joystick-Dual-Button-Button-CardKB-Mini-Keyboard-IoT/33001105045.html)**
## 概要
**BUTTON**ユニットは一つのボタンを備えたユニットです。ボタンが押されるとL、リリースされるとHを出力します。
NCピンは使用されていません。信号ポートはBtn(GPIO36)です。Grove Bポートで通信します。
**ユニット図:**
**信号出力:**
## 特徴
- GROVEインターフェースサポート、[UIFlow](http://flow.m5stack.com)、[Arduino](http://www.arduino.cc)をサポート
- LEGO 互換ホール
## パッケージ内容
- 1x BUTTON ユニット
- 1x Grove ケーブル
## アプリケーション
- 電灯スイッチ
- リモコンスイッチ
## 関連リンク
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
- **[フォーラム](http://forum.m5stack.com/)**
## サンプルコード
### 1. Arduino IDE
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/Arduino)。*
```arduino
#include
// declaration
int cur_value = 0;
// initialization
M5.begin();// init
pinMode(36, INPUT);// BUTTON Pin
// read data
cur_value = digitalRead(36);// read the value of BUTTON
M5.update();
```
### 2. UIFlow
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/UIFlow)。*
## 回路図
### ピンマッピング
| M5Core(GROVEインターフェースB) | GPIO36 | GPIO26 | 5V | GND |
| BUTTON Unit | Button Pin | | 5V | GND |