5.0 KiB
Module ENCODER
SKU:A006
Description
ENCODER is compatible with FACE Kit. You can have it replace the key-card 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 I2C (The default I2c address is: 0x5E)
Product Features
- 12 RGB Led
- I2C communication
- Simple API for programming
- Mega328 inside
- Encoder detection
Include
- 1x M5Stack ENCODER Module
Specification
| Resources | Parameter |
| RGB LED | x12 |
| Net weight | 27g |
| Gross weight | 47g |
| Product Size | 58.2*54.2*28mm |
| Package Size | 95*65*25mm |
| Material | Plastic(PC) |
EasyLoader
EasyLoader is a concise and fast program writer, which has a built-in case program related to the product. It can be burned to the main control by simple steps to perform a series of function verification. Please install the corresponding driver according to the device type. M5Core host Please click here to view the CP210X driver installation tutorial, M5StickC/V/T/ATOM series can be used without driver)
Description:
Display encoder count and button status, left turn decrease right turn increase.
Function
Control single 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;
}
}
Related Link
PinMap
Mega328 ISPDownload interface Pin foot definition
Example
1. Arduino IDE
If you want the complete code faces_encoder.ino, please click here
2. UIFlow
Last updated: 2020-12-24
<script> var purchase_link = 'https://m5stack.com/collections/m5-module/products/encoder-module'; anchor_search(purchase_link); scrollFunc(); </script>

