-->

Encoder Panel For FACES Kit (SK6812)

SKU:A006

Regular price $7.95
Standard Shipping Estimated Delivery Time: 7-20 days
Description

ENCODER is compatible with FACE Kit. You can have it replace the keycoard panel inside the FACE kit. It is designed for rotary encoder control, integrated Mega328 microprocessor inside and LEDs around the encoder.
The series communication protocol between M5 core and ENCODER is IIC (adress: 0x5E)

Product Features

  • 12 RGB Led
  • IIC communication
  • Simple API for programming
  • Mega328 inside
  • Encoder detection

Kit includes

  • 1x M5Stack ENCODER Module
  • Encoder turnpanel
Documents
Learn

Function

Control single LED

/*
    Parameter:
        led_index: 0 ~ 11
        r, g, b: 0 ~ 254
*/
void Led(int led_index, int r, int g, int b){
    // IIC 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;

    // IIC 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

If you want the complete code faces_encoder.ino, please click here.

/*
* faces_encoder.ino
*/
#include <M5Stack.h>

#define Faces_Encoder_I2C_ADDR     0X5E

// declaration
int encoder_increment;//positive: clockwise nagtive: anti-clockwise
uint16_t encoder_value=0;
int button_state;
uint8_t direction;//0: clockwise 1: anti-clockwise
int temp_encoder_increment;

// initialization
M5.begin();
Wire.begin();

// get data from ENCONDER
Wire.requestFrom(Faces_Encoder_I2C_ADDR, 3);
if(Wire.available()){
    temp_encoder_increment = Wire.read();// the first byte: increment
    button_state = Wire.read();// the second byte: button value
}

// IIC send data, 4bytes
Wire.beginTransmission(Faces_Encoder_I2C_ADDR);
Wire.write(led_index);
Wire.write(r);
Wire.write(g);
Wire.write(b);
Wire.endTransmission();

 

 

 

Customer Reviews

Based on 15 reviews
100%
(15)
0%
(0)
0%
(0)
0%
(0)
0%
(0)
L
L.H.

Encoder Panel For FACES Kit (SK6812)

J
J.W.

ok

B
B.F.

Encoder Panel For FACES Kit (SK6812)

A
A.S.

Encoder Panel For FACES Kit (SK6812)

E
E.T.

Good products. Took 9 days to Japan via registered China Post mail with tracking. Packet in hard shelled box.