diff --git a/docs/zh_CN/module/encoder.md b/docs/zh_CN/module/encoder.md index 68e7d51c..96d1b7bb 100644 --- a/docs/zh_CN/module/encoder.md +++ b/docs/zh_CN/module/encoder.md @@ -1,7 +1,6 @@ -# Module ENCODER {docsify-ignore-all} - - +# Module ENCODER +
@@ -10,8 +9,6 @@ **ENCODER** 是一款兼容 FACE 套件的旋钮控制面板.专为旋转编码控制而设计,其内部集成Mega328微处理器,在旋钮的周围嵌入了由12个LED组成的LED灯环. M5Core与ENCODER之间的串行通信协议是I2C(地址:0x5E) - - ## 产品特性 - 12 RGB Led @@ -71,12 +68,10 @@ void get_encoder_increment(void){ - 1x M5Stack ENCODER 模块 - 1x 编码器转盘 - ## 相关链接 - **[ENCODER 固件](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/ENCODER/firmware_328p/FacesEncoder328)** - ## EasyLoader >EasyLoader是一个简洁快速的程序烧录器,其内置了一个产品相关的案例程序,通过简单步骤将其烧录至主控,即可进行一系列的功能验证.**(程序烧录前,请根据设备类型安装相应驱动程序. M5Core型主机[请点击此处查看CP210X驱动安装教程](zh_CN/arduino/arduino_development?id=安装串口驱动),M5StickC/V/T/ATOM系列可免驱动使用)** @@ -114,53 +109,16 @@ void get_encoder_increment(void){ ### Arduino IDE -*以下代码仅为片段,如需获取完整代码, [请点击此处.](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/ENCODER/Arduino/faces_encoder).* - -```arduino -/* -* faces_encoder.ino -*/ -#include - -#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(); -``` +[点击此处下载Arduino代码](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/ENCODER/Arduino/faces_encoder) ### UIFlow -