2019-02-14 10:21:14 +08:00
|
|
|
# LIGHT ユニット {docsify-ignore-all}
|
2018-12-25 16:04:58 +08:00
|
|
|
|
|
|
|
|
<img src="assets/img/product_pics/unit/M5GO_Unit_light.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_light_grove_b.png" width="30%" height="30%">
|
|
|
|
|
|
|
|
|
|
***
|
|
|
|
|
|
2019-02-20 14:11:23 +08:00
|
|
|
: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:**[関連動画](#関連動画)**
|
2018-12-25 16:04:58 +08:00
|
|
|
|
|
|
|
|
## 概要
|
|
|
|
|
|
2019-02-26 12:46:53 +08:00
|
|
|
**<mark>LIGHT</mark>**ユニットは10KΩの閾値調整抵抗付き明るさセンサーです。明るさをアナログ値として、光のオンオフをデジタル値(0/1)として取得できます。
|
2018-12-25 16:04:58 +08:00
|
|
|
|
|
|
|
|
## 特徴
|
|
|
|
|
|
|
|
|
|
- 10KΩ調整抵抗による閾値調整可能
|
|
|
|
|
- アナログ & デジタル出力
|
|
|
|
|
- Grove インターフェース
|
|
|
|
|
- LEGO 互換ホール
|
|
|
|
|
|
2019-02-26 12:46:53 +08:00
|
|
|
## 関連リンク
|
|
|
|
|
|
|
|
|
|
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
|
|
|
|
|
|
|
|
|
|
- **[フォーラム](http://forum.m5stack.com/)**
|
|
|
|
|
|
2018-12-25 16:04:58 +08:00
|
|
|
## サンプルコード
|
|
|
|
|
|
|
|
|
|
### 1. Arduino IDE
|
|
|
|
|
|
2019-02-20 14:11:23 +08:00
|
|
|
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/LIGHT/Arduino)。*
|
2018-12-29 18:15:57 +08:00
|
|
|
|
|
|
|
|
```arduino
|
|
|
|
|
#include <M5Stack.h>
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
```
|
2018-12-25 16:04:58 +08:00
|
|
|
|
2019-02-22 15:38:20 +08:00
|
|
|
<img src="assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_04.png">
|
|
|
|
|
|
2018-12-25 16:04:58 +08:00
|
|
|
### 2. UIFlow
|
|
|
|
|
|
2019-02-20 14:11:23 +08:00
|
|
|
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/LIGHT/UIFlow)。*
|
2018-12-29 18:15:57 +08:00
|
|
|
|
2019-01-27 18:42:25 +08:00
|
|
|
<img src="assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_03.png">
|
2018-12-29 18:15:57 +08:00
|
|
|
|
2018-12-25 16:04:58 +08:00
|
|
|
## 回路図
|
|
|
|
|
|
|
|
|
|
<img src="assets/img/product_pics/unit/light_sch.JPG">
|
|
|
|
|
|
2018-12-27 16:13:35 +08:00
|
|
|
### ピンマップ
|
2018-12-25 16:04:58 +08:00
|
|
|
|
|
|
|
|
<table>
|
2018-12-29 18:15:57 +08:00
|
|
|
<tr><td>M5Core(GROVEインターフェースB)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
2019-02-20 14:11:23 +08:00
|
|
|
<tr><td>LIGHT Unit</td><td>アナログ値出力ピン</td><td>デジタル値出力ピン</td><td>5V</td><td>GND</td></tr>
|
2018-12-25 16:04:58 +08:00
|
|
|
</table>
|
|
|
|
|
|
2019-02-20 14:11:23 +08:00
|
|
|
## 関連動画
|
|
|
|
|
|
2019-03-20 16:32:45 +08:00
|
|
|
**LIGHT チュートリアル**
|
|
|
|
|
|
|
|
|
|
<video width="500" height="315" controls>
|
|
|
|
|
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/LukeVideo/m5stack%20iot%20lighting%20part%202%20-%20light%20sensor%20control.mp4" type="video/mp4">
|
|
|
|
|
</video>
|
|
|
|
|
|
2019-03-07 18:28:11 +08:00
|
|
|
**LIGHT デモ**
|
2019-02-20 14:11:23 +08:00
|
|
|
|
2019-03-20 16:32:45 +08:00
|
|
|
<video width="500" height="315" controls>
|
|
|
|
|
<source src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/video/Blog/Twitch201901/Light%20Units.mp4" type="video/mp4">
|
|
|
|
|
</video>
|