Module ENCODER

SKU:A006

説明

ENCODERはFACEキットに対応したエンコーダーです。FACEキット内のキーカード・パネルと交換させることができます。ロータリエンコーダ制御用に設計されており、内部にMega328マイクロプロセッサ、エンコーダ周辺にLEDが内蔵されています。

M5Coreコアとエンコーダ間の直列通信プロトコルはI2Cです(デフォルトのI2Cアドレスは0x5E)。

本製品は現在生産中止となっています。

製品の特徴

  • 12個のRGB LED
  • I2C通信
  • プログラミングのためのシンプルなAPI
  • Mega328を内蔵
  • エンコーダの検出

含まれるもの

  • 1x M5Stack ENCODER Module

仕様

リソース パラメータ
RGB LED x12
製品重量 27g
総重量 47g
製品サイズ 58.254.228mm
梱包サイズ 95 *65 * 25mm
材料 プラスチック(PC)

EasyLoader

EasyLoaderは簡潔で高速なプログラムライターで、製品に関連するケースプログラムを内蔵しています。簡単な手順で主制御に書き込み、一連の機能検証を行うことができます。

Windows版Easyloaderのダウンロード MacOS版Easyloaderのダウンロード

Description:
エンコーダのカウントとボタンの状態を表示し、左回りの減少 右回りの増加を表示します。

PinMap

Mega328 ISPDownload interface ピンフット定義

Learn

I have made the digital command station for model trains (www. zavavov. cz/en/tcs-en/) and now I am working on Wireless controller for it.

機能

単一のRGBを制御する

/*
    Parameter:
        led_index: 0 ~ 11
        r, g, b: 0 ~ 254
*/
void Led(int led_index, int r, int g, int b){
    // I2C send data
    Wire.beginTransmission(Faces_Encoder_I2C_ADDR);
    Wire.write(led_index);
    Wire.write(r);
    Wire.write(g);
    Wire.write(b);
    Wire.endTransmission();
}

Read encoder increment

void get_encoder_increment(void){
    int temp_encoder_increment;

    // I2C read data
    Wire.requestFrom(Faces_Encoder_I2C_ADDR, 3);
    if(Wire.available()){
       temp_encoder_increment = Wire.read();// get increment
       button_state = Wire.read();// get button value
    }
    if(temp_encoder_increment > 127){//anti-clockwise
        direction = 1;// flag for encoder direction
        encoder_increment = 256 - temp_encoder_increment;
    }
    else{// clockwise
        direction = 0;
        encoder_increment = temp_encoder_increment;
    }
}

関連リンク

Example

Arduino IDE

完全なコード faces_encoder.ino が必要な場合は、 ここ をクリックしてください。

UIFlow