mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
module(gps, lorawan) examples updated
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 76 KiB |
+13
-13
@@ -6,7 +6,7 @@
|
||||
|
||||
**M5Core**
|
||||
|
||||
[](en/core/basic)[](en/core/gray)[](en/core/fire)
|
||||
[](en/core/basic) [](en/core/gray) [](en/core/fire)
|
||||
|
||||
**MiniCore**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
**Kit**
|
||||
|
||||
[](en/core/m5go_iot_starter_kit)[](en/core/face_kit)
|
||||
[](en/core/m5go_iot_starter_kit) [](en/core/face_kit)
|
||||
|
||||
<!-- |[M5GO Starter Kit]()|[FACES Kit]()| -->
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
**Communication Modules**
|
||||
|
||||
[](en/module/gps) [](en/module/lora) [](en/module/lorawan) [](en/module/sim800)
|
||||
[](en/module/gps) [](en/module/lora) [](en/module/lorawan) [](en/module/sim800)
|
||||
|
||||
[](en/module/commu)
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
|
||||
**Expansion Modules**
|
||||
|
||||
[](en/module/battery)[](en/module/proto)[](en/module/plus)
|
||||
[](en/module/battery) [](en/module/proto) [](en/module/plus)
|
||||
|
||||
<!-- |[BATTERY]()|[PROTO]()| -->
|
||||
|
||||
**Drive Modules**
|
||||
|
||||
[](en/module/stepmotor)[](en/module/servo)
|
||||
[](en/module/stepmotor) [](en/module/servo)
|
||||
|
||||
<!-- [](en/module/lego_plus) -->
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<img src='assets/img/product_pics/5.jpg'> <img src='assets/img/product_pics/bases.png'>
|
||||
|
||||
[](en/base/lan_base) [](en/base/node_base)
|
||||
[](en/base/lan_base) [](en/base/node_base)
|
||||
|
||||
<!-- [](en/base/plc_base) -->
|
||||
|
||||
@@ -62,31 +62,31 @@
|
||||
|
||||
**Input/Sensing Unit**
|
||||
|
||||
[](en/unit/env) [](en/unit/ir) [](en/unit/pir) [](en/unit/angle)
|
||||
[](en/unit/env) [](en/unit/ir) [](en/unit/pir) [](en/unit/angle)
|
||||
|
||||
[](en/unit/adc)[](en/unit/dac)[](en/unit/button)[](en/unit/dual_button)
|
||||
[](en/unit/adc) [](en/unit/dac) [](en/unit/button) [](en/unit/dual_button)
|
||||
|
||||
[](en/unit/joystick)[](en/unit/earth)[](en/unit/color)[](en/unit/m5camera)
|
||||
[](en/unit/joystick) [](en/unit/earth) [](en/unit/color) [](en/unit/m5camera)
|
||||
|
||||
[](en/unit/light)[](en/unit/makey)[](en/unit/ncir)[](en/unit/thermal)
|
||||
[](en/unit/light) [](en/unit/makey) [](en/unit/ncir) [](en/unit/thermal)
|
||||
|
||||
[](en/unit/tof)
|
||||
<!-- |[ADC]()|[数字模拟转换Unit]()|[单按键]()|[双按键]()| -->
|
||||
|
||||
**Output/Controlling Unit**
|
||||
|
||||
[](en/unit/rgb)[](en/unit/relay)[](en/unit/neopixel)
|
||||
[](en/unit/rgb) [](en/unit/relay) [](en/unit/neopixel)
|
||||
|
||||
**Interface Unit**
|
||||
|
||||
[](en/unit/hub)[](en/unit/396port)
|
||||
[](en/unit/hub) [](en/unit/396port)
|
||||
[](en/unit/proto)
|
||||
|
||||
***
|
||||
|
||||
<img src='assets/img/product_pics/4.jpg'> <img src='assets/img/product_pics/application.png'>
|
||||
|
||||
[](en/app/bala) [](en/app/lidarbot)
|
||||
[](en/app/bala) [](en/app/lidarbot)
|
||||
|
||||
<!-- GitHub Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
+14
-14
@@ -6,7 +6,7 @@
|
||||
|
||||
**M5コア**
|
||||
|
||||
[](ja/core/basic)[](ja/core/gray)[](ja/core/fire)
|
||||
[](ja/core/basic) [](ja/core/gray) [](ja/core/fire)
|
||||
|
||||
**ミニコア**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
**セット**
|
||||
|
||||
[](ja/core/m5go_iot_starter_kit)[](ja/core/face_kit)
|
||||
[](ja/core/m5go_iot_starter_kit) [](ja/core/face_kit)
|
||||
|
||||
<!-- |[M5GO Starter Kit]()|[FACES Kit]()| -->
|
||||
|
||||
@@ -26,21 +26,21 @@
|
||||
|
||||
**通信モジュール**
|
||||
|
||||
[](ja/module/gps) [](ja/module/lora) [](ja/module/lorawan) [](ja/module/sim800)
|
||||
[](ja/module/gps) [](ja/module/lora) [](ja/module/lorawan) [](ja/module/sim800)
|
||||
|
||||
[](ja/module/commu) [](ja/module/usb)
|
||||
[](ja/module/commu) [](ja/module/usb)
|
||||
|
||||
<!-- |[GPS]()|[LORA]()|[SIM800/GPRS/GSM]()|[COMMU]()| -->
|
||||
|
||||
**拡張モジュール**
|
||||
|
||||
[](ja/module/battery)[](ja/module/proto)[](ja/module/plus)
|
||||
[](ja/module/battery) [](ja/module/proto) [](ja/module/plus)
|
||||
|
||||
<!-- |[BATTERY]()|[PROTO]()| -->
|
||||
|
||||
**駆動モジュール**
|
||||
|
||||
[](ja/module/stepmotor)[](ja/module/servo)[](ja/module/lego_plus)
|
||||
[](ja/module/stepmotor) [](ja/module/servo) [](ja/module/lego_plus)
|
||||
|
||||
<!-- |[STEPMOTOR]()|[SERVO]()| -->
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<img src='assets/img/product_pics/5.jpg'> <img src='assets/img/product_pics/bases.png'>
|
||||
|
||||
[](ja/base/lan_base) [](ja/base/node_base)
|
||||
[](ja/base/lan_base) [](ja/base/node_base)
|
||||
|
||||
<!-- [](ja/base/plc_base) -->
|
||||
|
||||
@@ -58,31 +58,31 @@
|
||||
|
||||
**入力/センシングユニット**
|
||||
|
||||
[](ja/unit/env) [](ja/unit/ir) [](ja/unit/pir) [](ja/unit/angle)
|
||||
[](ja/unit/env) [](ja/unit/ir) [](ja/unit/pir) [](ja/unit/angle)
|
||||
|
||||
[](ja/unit/adc)[](ja/unit/dac)[](ja/unit/button)[](ja/unit/dual_button)
|
||||
[](ja/unit/adc) [](ja/unit/dac) [](ja/unit/button) [](ja/unit/dual_button)
|
||||
|
||||
[](ja/unit/joystick)[](ja/unit/earth)[](ja/unit/color)[](ja/unit/m5camera)
|
||||
[](ja/unit/joystick) [](ja/unit/earth) [](ja/unit/color) [](ja/unit/m5camera)
|
||||
|
||||
[](ja/unit/light)[](ja/unit/makey)[](ja/unit/ncir)[](ja/unit/thermal)
|
||||
[](ja/unit/light) [](ja/unit/makey) [](ja/unit/ncir) [](ja/unit/thermal)
|
||||
|
||||
[](ja/unit/tof)
|
||||
<!-- |[ADC]()|[数字模拟转换Unit]()|[单按键]()|[双按键]()| -->
|
||||
|
||||
**出力/制御ユニット**
|
||||
|
||||
[](ja/unit/rgb)[](ja/unit/relay)[](ja/unit/neopixel)
|
||||
[](ja/unit/rgb) [](ja/unit/relay) [](ja/unit/neopixel)
|
||||
|
||||
**インターフェースユニット**
|
||||
|
||||
[](ja/unit/hub)[](ja/unit/396port)
|
||||
[](ja/unit/hub) [](ja/unit/396port)
|
||||
[](ja/unit/proto)
|
||||
|
||||
***
|
||||
|
||||
<img src='assets/img/product_pics/4.jpg'> <img src='assets/img/product_pics/application.png'>
|
||||
|
||||
[](ja/app/bala) [](ja/app/lidarbot)
|
||||
[](ja/app/bala) [](ja/app/lidarbot)
|
||||
|
||||
<!-- GitHub Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
+24
-27
@@ -6,9 +6,9 @@
|
||||
|
||||
**主控M5Core**
|
||||
|
||||
[](zh_CN/core/basic)[](zh_CN/core/gray)[](zh_CN/core/fire)
|
||||
[](zh_CN/core/basic) [](zh_CN/core/gray) [](zh_CN/core/fire)
|
||||
|
||||
<!-- [](zh_CN/core/basic)[](zh_CN/core/gray)[](zh_CN/core/fire) -->
|
||||
<!-- [](zh_CN/core/basic) [](zh_CN/core/gray) [](zh_CN/core/fire) -->
|
||||
|
||||
**MiniCore**
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
**套件**
|
||||
|
||||
[](zh_CN/core/m5go_iot_starter_kit)[](zh_CN/core/face_kit)
|
||||
[](zh_CN/core/m5go_iot_starter_kit) [](zh_CN/core/face_kit)
|
||||
|
||||
<!-- [](zh_CN/core/m5go_iot_starter_kit)[](zh_CN/core/face_kit) -->
|
||||
<!-- [](zh_CN/core/m5go_iot_starter_kit) [](zh_CN/core/face_kit) -->
|
||||
|
||||
***
|
||||
|
||||
@@ -28,19 +28,19 @@
|
||||
|
||||
**通讯模块**
|
||||
|
||||
[](zh_CN/module/gps) [](zh_CN/module/lora) [](zh_CN/module/lorawan) [](zh_CN/module/sim800)
|
||||
[](zh_CN/module/gps) [](zh_CN/module/lora) [](zh_CN/module/lorawan) [](zh_CN/module/sim800)
|
||||
|
||||
<!-- [](zh_CN/module/gps)[](zh_CN/module/lora)[](zh_CN/module/lorawan)[](zh_CN/module/sim800) -->
|
||||
<!-- [](zh_CN/module/gps) [](zh_CN/module/lora) [](zh_CN/module/lorawan) [](zh_CN/module/sim800) -->
|
||||
|
||||
[](zh_CN/module/commu)[](zh_CN/module/usb)
|
||||
[](zh_CN/module/commu) [](zh_CN/module/usb)
|
||||
|
||||
**拓展模块**
|
||||
|
||||
[](zh_CN/module/battery)[](zh_CN/module/proto)[](zh_CN/module/plus)
|
||||
[](zh_CN/module/battery) [](zh_CN/module/proto) [](zh_CN/module/plus)
|
||||
|
||||
**驱动模块**
|
||||
|
||||
[](zh_CN/module/stepmotor)[](zh_CN/module/servo)[](zh_CN/module/lego_plus)
|
||||
[](zh_CN/module/stepmotor) [](zh_CN/module/servo) [](zh_CN/module/lego_plus)
|
||||
|
||||
***
|
||||
|
||||
@@ -56,52 +56,49 @@
|
||||
|
||||
**通讯类Unit**
|
||||
|
||||
[](zh_CN/unit/gps)
|
||||
[](zh_CN/unit/m5camera)
|
||||
|
||||
**输入/传感类Unit**
|
||||
[](zh_CN/unit/env) [](zh_CN/unit/ir) [](zh_CN/unit/pir) [](zh_CN/unit/angle)
|
||||
|
||||
[](zh_CN/unit/env) [](zh_CN/unit/ir) [](zh_CN/unit/pir) [](zh_CN/unit/angle)
|
||||
[](zh_CN/unit/adc) [](zh_CN/unit/dac) [](zh_CN/unit/button) [](zh_CN/unit/dual_button)
|
||||
|
||||
[](zh_CN/unit/adc)[](zh_CN/unit/dac)[](zh_CN/unit/button)[](zh_CN/unit/dual_button)
|
||||
[](zh_CN/unit/joystick) [](zh_CN/unit/earth) [](zh_CN/unit/color) [](zh_CN/unit/gps)
|
||||
|
||||
[](zh_CN/unit/joystick)[](zh_CN/unit/earth)[](zh_CN/unit/color)[](zh_CN/unit/m5camera)
|
||||
[](zh_CN/unit/light) [](zh_CN/unit/makey) [](zh_CN/unit/ncir) [](zh_CN/unit/thermal)
|
||||
|
||||
[](zh_CN/unit/light)[](zh_CN/unit/makey)[](zh_CN/unit/ncir)[](zh_CN/unit/thermal)
|
||||
|
||||
[](zh_CN/unit/tof)
|
||||
[](zh_CN/unit/tof) [](zh_CN/unit/rgb) [](zh_CN/unit/relay) [](zh_CN/unit/neopixel)
|
||||
|
||||
<!-- [](zh_CN/unit/env) [](zh_CN/unit/ir) [](zh_CN/unit/pir) [](zh_CN/unit/angle)
|
||||
|
||||
[](zh_CN/unit/adc)[](zh_CN/unit/dac)[](zh_CN/unit/button)[](zh_CN/unit/dual_button)
|
||||
[](zh_CN/unit/adc) [](zh_CN/unit/dac) [](zh_CN/unit/button) [](zh_CN/unit/dual_button)
|
||||
|
||||
[](zh_CN/unit/light)[](zh_CN/unit/makey)[](zh_CN/unit/ncir)[](zh_CN/unit/thermal)
|
||||
[](zh_CN/unit/light) [](zh_CN/unit/makey) [](zh_CN/unit/ncir) [](zh_CN/unit/thermal)
|
||||
|
||||
[](zh_CN/unit/joystick)[](zh_CN/unit/earth)[](zh_CN/unit/color)[](zh_CN/unit/tof) -->
|
||||
[](zh_CN/unit/joystick) [](zh_CN/unit/earth) [](zh_CN/unit/color) [](zh_CN/unit/tof) -->
|
||||
|
||||
<!-- [](zh_CN/unit/m5camera) -->
|
||||
|
||||
<!-- [](zh_CN/unit/heart) -->
|
||||
|
||||
**输出/控制类Unit**
|
||||
|
||||
[](zh_CN/unit/rgb)[](zh_CN/unit/relay)[](zh_CN/unit/neopixel)
|
||||
|
||||
<!-- [](zh_CN/unit/rgb)[](zh_CN/unit/relay) -->
|
||||
<!-- [](zh_CN/unit/rgb) [](zh_CN/unit/relay) -->
|
||||
|
||||
<!-- [](zh_CN/unit/neopixel) -->
|
||||
|
||||
**接口类Unit**
|
||||
<!-- [](zh_CN/unit/rgb) [](zh_CN/unit/relay) [](zh_CN/unit/neopixel) -->
|
||||
|
||||
[](zh_CN/unit/rgb)[](zh_CN/unit/relay)[](zh_CN/unit/neopixel)
|
||||
[](zh_CN/unit/hub) [](zh_CN/unit/396port)
|
||||
[](zh_CN/unit/proto)
|
||||
|
||||
<!-- [](zh_CN/unit/hub)[](zh_CN/unit/396port)
|
||||
<!-- [](zh_CN/unit/hub) [](zh_CN/unit/396port)
|
||||
[](zh_CN/unit/proto) -->
|
||||
|
||||
***
|
||||
|
||||
<img src='assets/img/product_pics/4.jpg'> <img src='assets/img/product_pics/application.png'>
|
||||
|
||||
[](zh_CN/app/bala) [](zh_CN/app/lidarbot)
|
||||
[](zh_CN/app/bala)[](zh_CN/app/lidarbot)
|
||||
|
||||
|
||||
<!-- <img src='assets/img/product_pics/6.jpg'> <img src='assets/img/product_pics/tool.png'>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
GPS 模块是一款内置了GPS小模组的M5Stack系列可堆叠模块。内置的GPS小模块名字为UBLOX NEO-M8N。堆叠了M5Core之后,你可以用UiFlow、Arduino和MicroPython来编程它。它都可提供全球定位信息,即使你在室外的任何地方。模块上电之后,就会一直接收定位信息。M5Core烧录[例程](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/GPS/Arduino),堆叠了GPS模块和连接PC串口之后,屏幕和PC的串口显示终端就会打印GPS接收到的信息。
|
||||
|
||||
GPS Module内部默认是通过UART2(GPIO16, GPIO17)与M5Core通讯,你可以通过修改0欧姆电阻跳线修改。
|
||||
|
||||
## 特性
|
||||
|
||||
- GPS NEO-M8N模块
|
||||
@@ -37,18 +39,36 @@ GPS 模块是一款内置了GPS小模组的M5Stack系列可堆叠模块。内置
|
||||
|
||||
## 例程
|
||||
|
||||
### 1. Arduino IDE
|
||||
### Arduino IDE
|
||||
|
||||
```c++
|
||||
GPSRaw.begin(9600);
|
||||
#include <M5Stack.h>
|
||||
|
||||
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
|
||||
|
||||
@@ -48,39 +48,8 @@ M5Stack LoRa模块适用于长距离通信,结合多个LoRa模块,能组成
|
||||
|
||||
## 例程
|
||||
|
||||
### 1. Arduino IDE
|
||||
### Arduino IDE
|
||||
|
||||
这是主从LORA模块点对点通信的例程,模块与M5Core之间通过AT指令通讯。
|
||||
|
||||
```c++
|
||||
/*
|
||||
* Master.ino
|
||||
*/
|
||||
Serial2.begin(9600, SERIAL_8N1, 16, 17);
|
||||
|
||||
/* LoRaWAN Init */
|
||||
//entry test mode
|
||||
Serial2.print("AT+Mode=Test");
|
||||
//Configure the modem,like Freq, SF, BW, Preamble length, TX output power
|
||||
Serial2.print("AT+TEST=RFCFG,472.3,8,250,8,8,20");
|
||||
//send data as HEX format
|
||||
Serial2.print("AT+TEST=TXLRPKT,"00 00 01 00 00 AF 80 07 02 00 00 39"");
|
||||
```
|
||||
|
||||
```c++
|
||||
/*
|
||||
* Slaver.ino
|
||||
*/
|
||||
Serial2.begin(9600, SERIAL_8N1, 16, 17);
|
||||
/* LoRaWAN Init */
|
||||
//entry test mode
|
||||
Serial2.print("AT+Mode=Test");
|
||||
//Configure the modem,like Freq, SF, BW, Preamble length
|
||||
Serial2.print("AT+TEST=RFCFG,472.3,8,250,8,8,20");
|
||||
//allow to receive data
|
||||
Serial2.print("AT+TEST=RXLRPKT");
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LORAWAN/Arduino)。
|
||||
|
||||
## 原理图
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
@@ -52,4 +52,80 @@ LoRaWAN默认的串口配置:
|
||||
|
||||
## 例程
|
||||
|
||||
## 原理图
|
||||
这是主从LORA模块点对点通信的例程,模块与M5Core之间通过AT指令通讯。
|
||||
|
||||
```c++
|
||||
/*
|
||||
Master.ino
|
||||
*/
|
||||
|
||||
#include <M5Stack.h>
|
||||
|
||||
// entry test mode
|
||||
String cmd_test_mode = "AT+Mode=Test";
|
||||
// Configure the modem,like Freq, SF, BW, Preamble length, TX output power
|
||||
String cmd_rfconf = "AT+TEST=RFCFG,472.3,8,250,8,8,20";
|
||||
// send data as HEX format
|
||||
String cmd_send_data = "AT+TEST=TXLRPKT,"00 00 01 00 00 AF 80 07 02 00 00 39"";
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
Serial.begin(9600);
|
||||
Serial2.begin(9600, SERIAL_8N1, 16, 17);
|
||||
|
||||
/* LoRaWAN Init */
|
||||
Serial2.print(cmd_test_mode);
|
||||
Serial2.print(cmd_rfconf);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Serial2.print(cmd_send_data);
|
||||
delay(200);
|
||||
|
||||
if(Serial2.available()) {
|
||||
int ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```c++
|
||||
/*
|
||||
Slaver.ino
|
||||
*/
|
||||
|
||||
#include <M5Stack.h>
|
||||
|
||||
// entry test mode
|
||||
String cmd_test_mode = "AT+Mode=Test";
|
||||
// Configure the modem,like Freq, SF, BW, Preamble length
|
||||
String cmd_rfconf = "AT+TEST=RFCFG,472.3,8,250,8,8,20";
|
||||
// allow to receive data
|
||||
String cmd_receive_data = "AT+TEST=RXLRPKT";
|
||||
|
||||
void setup() {
|
||||
M5.begin();
|
||||
Serial.begin(9600);
|
||||
Serial2.begin(9600, SERIAL_8N1, 16, 17);
|
||||
|
||||
/* LoRaWAN Init */
|
||||
Serial2.print(cmd_test_mode);
|
||||
Serial2.print(cmd_rfconf);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
//allow for receiving data
|
||||
//actually it need to be send once you change rf configuration or reset device
|
||||
Serial2.print(cmd_receive_data);
|
||||
delay(200);
|
||||
if(Serial2.available()) {
|
||||
int ch = Serial2.read();
|
||||
Serial.write(ch);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
具体例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LORAWAN/Arduino)。
|
||||
|
||||
<!-- ## 原理图 -->
|
||||
Reference in New Issue
Block a user