diff --git a/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_01.png b/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_01.png index 51231b8b..7e256ffc 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_01.png and b/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_02.png b/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_02.png index 988596f2..0cd5d059 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_02.png and b/docs/assets/img/product_pics/unit/unit_example/IR/example_unit_ir_02.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_01.png b/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_01.png index 849b2cff..3ec0e38f 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_01.png and b/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_02.png b/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_02.png index d68dc9c1..c4694142 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_02.png and b/docs/assets/img/product_pics/unit/unit_example/JOYSTICK/example_unit_joystick_02.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_01.png b/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_01.png index 0b2c23cf..1c3dabea 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_01.png and b/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_02.png b/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_02.png index 6431147b..bac33e3f 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_02.png and b/docs/assets/img/product_pics/unit/unit_example/LIGHT/example_unit_light_02.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_01.png b/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_01.png index 7027ab1a..cd60d94f 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_01.png and b/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_01.png differ diff --git a/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_02.png b/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_02.png index cf33488f..ef88938e 100644 Binary files a/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_02.png and b/docs/assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_02.png differ diff --git a/docs/zh_CN/module/gps.md b/docs/zh_CN/module/gps.md index 9bcb9cf1..333f94a1 100644 --- a/docs/zh_CN/module/gps.md +++ b/docs/zh_CN/module/gps.md @@ -68,7 +68,7 @@ void loop() { } ``` -烧录`GPSRaw.ino`之后,屏幕和串口显示终端会打印如下类似的信息 +烧录例程`GPSRaw.ino`之后,屏幕和串口显示终端会打印如下类似的信息 ``` $GPGSA,A,1,,,,,,,,,,,,,25.5,25.5,25.5*02 diff --git a/docs/zh_CN/module/lora.md b/docs/zh_CN/module/lora.md index be7eef69..efd9e0b1 100644 --- a/docs/zh_CN/module/lora.md +++ b/docs/zh_CN/module/lora.md @@ -37,14 +37,13 @@ M5Stack LoRa模块适用于长距离通信,结合多个LoRa模块,能组成 - **[LoRa模块信息](http://wiki.ai-thinker.com/lora) (LoRa)** -?> **Note** 如果堆叠了LoRa模块之后,上电,可是M5Core不能正常显示或者有其他显示问题时,建议在`m5.begin();`语句之前加入如下语句 +?> 如果堆叠了LoRa模块之后,上电,可是M5Core不能正常显示或者有其他显示问题时,建议在`m5.begin();`语句之前加入如下语句。因为GPIO5连接到LoRa模块的NSS引脚,该引脚在系统上电的时候需要上拉,从而避免LCD不能显示。 ```arduino pinMode(5,OUTPUT); digitalWrite(5,HIGH); m5.begin(); ``` -?> **Note** 因为GPIO5连接到LoRa模块的NSS引脚,该引脚在系统上电的时候需要上拉,从而避免LCD不能显示。 ## 例程 diff --git a/docs/zh_CN/unit/color.md b/docs/zh_CN/unit/color.md index ccd8982c..e41481b0 100644 --- a/docs/zh_CN/unit/color.md +++ b/docs/zh_CN/unit/color.md @@ -37,7 +37,7 @@ Color是一个颜色传感器. 通过GROVE接口(I2C)与M5Core相连,能够识 /* Color test hardware: M5Stack - + please install the Adfruit TCS34725 library first ... */ @@ -58,7 +58,8 @@ static uint16_t color16(uint16_t r, uint16_t g, uint16_t b) { return _color; } -Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,TCS34725_GAIN_4X); +Adafruit_TCS34725 tcs; +tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,TCS34725_GAIN_4X); void setup() { delay(100); @@ -80,8 +81,8 @@ void setup() { void loop() { uint16_t clear, red, green, blue; - delay(60); // takes 50ms to read - + delay(60); // takes 50ms to read + tcs.getRawData(&red, &green, &blue, &clear); Serial.print("C:\t"); Serial.print(clear); @@ -97,7 +98,7 @@ void loop() { b = blue; b /= sum; r *= 256; g *= 256; b *= 256; Serial.print("\t"); - Serial.print((int)r, HEX); Serial.print((int)g, HEX); Serial.println((int)b, HEX); + Serial.print((int)r,HEX); Serial.print((int)g,HEX); Serial.println((int)b,HEX); uint16_t _color = color16((int)r, (int)g, (int)b); M5.Lcd.clear(_color); } diff --git a/docs/zh_CN/unit/gps.md b/docs/zh_CN/unit/gps.md index 6a2f9841..a15526d4 100644 --- a/docs/zh_CN/unit/gps.md +++ b/docs/zh_CN/unit/gps.md @@ -7,7 +7,7 @@ :memo:**[描述](#描述)**      :octocat:**[例程](#例程)**      🛒**[购买链接](https://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-1172588106.13.51a6425e6lnUwE&id=583664452054)** - + ## 描述 @@ -45,15 +45,33 @@ ### 1. Arduino IDE ```arduino -GPSRaw.begin(9600); +#include -if(GPSRaw.available()) { - int ch = GPSRaw.read(); +/* By default, GPS is connected with M5Core through UART2 */ +HardwareSerial GPSRaw(2); + +void setup() { + M5.begin(); + GPSRaw.begin(9600);// GPS init + Serial.println("hello"); + termInit(); +} + +void loop() { + // put your main code here, to run repeatedly: + if(Serial.available()) { + int ch = Serial.read(); + GPSRaw.write(ch); + } + if(GPSRaw.available()) { + int ch = GPSRaw.read();// read GPS information Serial.write(ch); + termPutchar(ch); + } } ``` -烧录[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/GPS/Arduino)之后,屏幕和串口显示终端会打印如下类似的信息 +烧录例程`GPSRaw.ino`之后,屏幕和串口显示终端会打印如下类似的信息 ``` $GPGSA,A,1,,,,,,,,,,,,,25.5,25.5,25.5*02 @@ -75,6 +93,6 @@ $GPTXT,01,01,01,ANTENNA OPEN*25 ### 管脚映射 - - + +
M5Core(GROVE C)GPIO16GPIO17
5VGND
GPS UnitTXDRXD
5VGND
M5Core(GROVE接口C)ESP32串口2接收引脚U2RXD(GPIO16)ESP32串口2发送引脚U2TXD(GPIO17)5VGND
北斗导航Unit信号发送引脚TXD信号接收引脚RXD5VGND
diff --git a/docs/zh_CN/unit/ir.md b/docs/zh_CN/unit/ir.md index 9c78d05f..935c0388 100644 --- a/docs/zh_CN/unit/ir.md +++ b/docs/zh_CN/unit/ir.md @@ -50,7 +50,7 @@ void loop() { ### 2. UIFlow - + 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/IR/UIFlow)。 diff --git a/docs/zh_CN/unit/joystick.md b/docs/zh_CN/unit/joystick.md index 5dc30e47..c194e0ab 100644 --- a/docs/zh_CN/unit/joystick.md +++ b/docs/zh_CN/unit/joystick.md @@ -20,6 +20,7 @@ Joystick Unit同样也是与M5Core相连之后,通过PORT A(I2C)控制,其I2 ## 特性 +- X, Y方向的范围10~250, Z方向(0: 未按下, 1: 按下) - GROVE接口,支持[UiFlow](http://flow.m5stack.com)编程,[Arduino](http://www.arduino.cc)编程 - Unit内置两个Lego插件孔,方便与Lego件结合 @@ -52,12 +53,11 @@ uint8_t y_data; uint8_t button_data; char data[100]; void loop() { - // put your main code here, to run repeatedly: Wire.requestFrom(JOY_ADDR, 3); if (Wire.available()) { - x_data = Wire.read(); - y_data = Wire.read(); - button_data = Wire.read(); + x_data = Wire.read();// X(range: 10~250) + y_data = Wire.read();// Y(range: 10~250) + button_data = Wire.read();// Z(0: released 1: pressed) sprintf(data, "x:%d y:%d button:%d\n", x_data, y_data, button_data); Serial.print(data); } diff --git a/docs/zh_CN/unit/light.md b/docs/zh_CN/unit/light.md index 3967412a..df2bf180 100644 --- a/docs/zh_CN/unit/light.md +++ b/docs/zh_CN/unit/light.md @@ -10,6 +10,8 @@ LIGHT是一款光线传感器,内置光敏电阻和10K的可调电阻,可以通过调节可调电阻,从而改变触发信号的光强阈值。Unit的GRVE接口可以输出数字信号或者光强对应的模拟信号(电压信号)。 +LIGHT在光强弱的时候,数字引脚输出高电平,即数字信号"1",否则输出"0"。 + ## 特性 - 10K可调电阻 @@ -44,14 +46,14 @@ uint16_t digitalRead_value = 0; void loop() { analogRead_value = analogRead(36);// read analog value of LIGHT - digitalRead_value = digitalRead(26);// read digital value of LIGHT + digitalRead_value = digitalRead(26); delay(10); } ``` ### 2. UIFlow - + 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/LIGHT/UIFlow)。 diff --git a/docs/zh_CN/unit/pir.md b/docs/zh_CN/unit/pir.md index 4307a19e..4a1fdfa1 100644 --- a/docs/zh_CN/unit/pir.md +++ b/docs/zh_CN/unit/pir.md @@ -10,6 +10,8 @@ PIR是一款感应人体(生物)红外信号的Unit,通过该Unit可以感知Unit前面是否有人经过,适用于做人体感应方面的项目。 +如果PIR感应到红外变动,信号引脚会输出高电平,否则一直处于低电平状态。 + ## 特性 - 检测距离:150cm @@ -37,14 +39,14 @@ void setup() { } void loop() { - int value = digitalRead(36);// read the pin + int value = digitalRead(36);// read the pin(0: not detectd 1: detected) M5.update(); } ``` ### 2. UIFlow - + 具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PIR/UIFlow)。