Files
2019-03-20 16:32:45 +08:00

2.9 KiB

PLUS モジュール {docsify-ignore-all}


📝概要      :octocat:サンプルコード      🔌回路図      🛒購入リンク      🎬関連動画

概要

**PLUS**モジュールは500mAhのバッテリ、ロータリエンコーダ、IR送信機、PORT B(GPIO)、PORT C(UART)そしてマイクジャックの為のパッドを備えています。M5Stackの下に重ねるだけで、機能を強化することが出来ます。M5Stackとの通信にはI2Cを使用します。I2Cアドレスは **0x89**です。

特徴

  • 500mAh バッテリー
  • プログラマブルロータリエンコーダ
  • IR送信機
  • PORT B (GPIO)
  • PORT C (UART)

パッケージ内容

  • 1x PLUS モジュール

関連リンク

サンプルコード

1. Arduino IDE

完全なソースコードはこちらplus_read_encoder.ino

/*
* ギアポテンショメータのデータを読む
* 赤外線ライト
*/
#include <Arduino.h>
#include <M5Stack.h>

#define IrPin 13
#define PLUS_ADDR 0x62

// declaration
int32_t number = 0;
uint8_t press = 0;

// initialization
M5.begin(true, false, false);
Wire.begin();
ledcSetup(1, 38000, 10); ledcAttachPin(IrPin, 1);// IR Pin setting

// read data
Wire.requestFrom(PLUS_ADDR, 2);
while(Wire.available()) {
    int8_t encode = Wire.read();
    uint8_t press_n = Wire.read();
    number += encode;
    if(press_n == 0xff) {
        press = 0;//encoder was pressed
    }
    else {
        press = 1;//encoder was releaed
    }
}

回路図

関連動画

PLUS デモ - ツリーメニューの操作