Files

101 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2019-02-14 10:21:14 +08:00
# MAKEY ユニット {docsify-ignore-all}
2018-12-25 16:04:58 +08:00
2018-12-29 18:15:57 +08:00
<img src="assets/img/product_pics/unit/M5GO_Unit_makey.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_makey_grove_a.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/M5GO_Unit_makey_02.png" width="30%" height="30%">
2018-12-25 16:04:58 +08:00
***
2019-03-21 19:22:50 +08:00
:memo:**[概要](#概要)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:octocat:**[サンプルコード](#サンプルコード)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:electric_plug:**[回路図](#回路図)**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;🛒**[購入リンク](https://www.aliexpress.com/store/product/M5Stack-Official-Makey-Unit-MEGA328P-Inside-16Key-Fruit-Paino-with-NEO-Pixel-and-BUZZER-for-ESP32/3226069_32924883456.html)**
2018-12-25 16:04:58 +08:00
## 概要
**<mark>MAKEY</mark>**ユニットはATmega328Pを内蔵し、自由に使用可能な16本のIOピンを備えています。GroveポートAで接続し、I2Cで通信します。I2Cアドレスは**0x51**です。
2019-03-21 19:22:50 +08:00
*注意事項:**
1)ユニットのブザーで鳴らす場合
ユニットのGNDホールに接続したデュポン線の端を左手に持ちます。
もうひとつ別のデュポン線の端を右手に持ちます。右手のデュポン線をユニットのトーンホールに触れさせると、MAKEYから対応する音が鳴ります。
2)M5Coreのスピーカーで鳴らす場合
**GroveポートA**でM5Coreにユニットを接続し、こちらの[サンプルコード](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/Makey_NewVersion/Arduino/Makey_new_version)を書き込みます。
あとはMakeyで鳴らすのと同じで、ユニットのGNDホールに接続したデュポン線の端を左手に持ちます。
もうひとつ別のデュポン線の端を右手に持ちます。右手のデュポン線をユニットのトーンホールに触れさせると、M5Coreから対応する音が鳴ります。
2018-12-25 16:04:58 +08:00
## 特徴
- ATmega328P 内蔵
- ブザー内蔵
2019-03-21 19:22:50 +08:00
- GROVEインターフェース、プログラミングサポート [UIFlow](http://flow.m5stack.com)、[Arduino](http://www.arduino.cc)
2018-12-25 16:04:58 +08:00
- LEGO 互換ホール
## パッケージ内容
- 1x MAKEY ユニット
- 1x GROVE ケーブル
2018-12-25 16:04:58 +08:00
## アプリケーション
2019-03-21 19:22:50 +08:00
- フルートピアノ
2018-12-25 16:04:58 +08:00
2018-12-29 18:15:57 +08:00
<img src="assets/img/product_pics/unit/M5GO_Unit_makey_05.png" width="40%" height="40%">
2019-03-21 19:22:50 +08:00
## 関連リンク
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
- **[フォーラム](http://forum.m5stack.com/)**
- **[モジュール内のMEGA328ファームウェア](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/Makey_NewVersion/firmware_328p)**
2018-12-25 16:04:58 +08:00
## サンプルコード
### 1. Arduino IDE
2019-04-03 16:31:57 +08:00
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/Makey_NewVersion/Arduino/Makey_new_version)。*
2018-12-29 18:15:57 +08:00
```arduino
#include <M5Stack.h>
#include <Wire.h>
// initialization
M5.begin();
pinMode(21, INPUT); pinMode(22, INPUT);
Wire.begin();// Init I2C
// read data
Wire.requestFrom(MAKEY_ADDR, 2);
while (Wire.available()) {
Key1 = Wire.read();//read data from MAKEY
Key2 = Wire.read();//read data from MAKEY
tone_key = (Key2<<8) | Key1;// the following picture will explain "tone_key"
}
```
<img src="assets/img/product_pics/unit/unit_example/MAKEY/tone_key_pitch_zh_CN.png">
<img src="assets/img/product_pics/unit/M5GO_Unit_makey_04.png" width="30%" height="30%">
2018-12-25 16:04:58 +08:00
### 2. UIFlow
*完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/MAKEY/UIFlow)。*
2018-12-25 16:04:58 +08:00
2019-01-27 18:42:25 +08:00
<img src="assets/img/product_pics/unit/unit_example/MAKEY/example_unit_makey_02.png">
2018-12-29 18:15:57 +08:00
2019-01-15 18:13:30 +08:00
## 回路図
2018-12-29 18:15:57 +08:00
2019-01-15 18:13:30 +08:00
<img src="assets/img/product_pics/unit/makey_sch.png">
2018-12-25 16:04:58 +08:00
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インターフェースA)</td><td>GPIO22</td><td>GPIO21</td><td>5V</td><td>GND</td></tr>
2018-12-25 16:04:58 +08:00
<tr><td>MAKEY Unit</td><td>SCL</td><td>SDA</td><td>5V</td><td>GND</td></tr>
</table>
2018-12-29 18:15:57 +08:00
<img src="assets/img/product_pics/unit/M5GO_Unit_makey_03.png" width="30%" height="30%">