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

***
:memo:**[概要](#概要)** :octocat:**[サンプルコード](#サンプルコード)** :electric_plug:**[回路図](#回路図)** 🛒**[購入リンク](https://www.aliexpress.com/item/M5Stack-Official-Light-Unit-with-Photoresistance-Grove-Port-Analog-Digital-Output-Compatible-with-M5GO-FIRE-ESP32/32920589923.html)** :clapper:**[関連動画](#関連動画)**
## 概要
**LIGHT**ユニットは10KΩの閾値調整抵抗付き明るさセンサーです。明るさをアナログ値として、光のオンオフをデジタル値(0/1)として取得できます。
## 特徴
- 10KΩ調整抵抗による閾値調整可能
- アナログ & デジタル出力
- Grove インターフェース
- LEGO 互換ホール
## 関連リンク
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
- **[フォーラム](http://forum.m5stack.com/)**
## サンプルコード
### 1. Arduino IDE
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/LIGHT/Arduino)。*
```arduino
#include
// declaration
uint16_t analogRead_value = 0;
uint16_t digitalRead_value = 0;
// initialization
M5.begin();
dacWrite(25, 0);// disable the speak noise
pinMode(26, INPUT);// LIGHT Pin setting
// read data
analogRead_value = analogRead(36);// read analog value of LIGHT
digitalRead_value = digitalRead(26);
```
### 2. UIFlow
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/LIGHT/UIFlow)。*
## 回路図
### ピンマップ
| M5Core(GROVEインターフェースB) | GPIO36 | GPIO26 | 5V | GND |
| LIGHT Unit | アナログ値出力ピン | デジタル値出力ピン | 5V | GND |
## 関連動画
**LIGHT チュートリアル**
**LIGHT デモ**