mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
add example for LORA
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 776 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 59 KiB |
+60
-6
@@ -43,14 +43,68 @@ account the distance, anti-interference and power consumption
|
||||
|
||||
- **[LoRa Info](http://wiki.ai-thinker.com/lora) (LoRa)**
|
||||
|
||||
?> **Note** If your board LCD can't display or has some other problem, we suggest
|
||||
you to add the two statements code followed by ``m5.begin();`` as shown
|
||||
below
|
||||
?> If your board LCD can't display or has some other problem, we suggest you to add the two statements code followed by ``m5.begin();`` as shown below. Because GPIO5 who has connected NSS pin of LoRa module need be pull-up at the moment your board(or system) power on to prevent system's LCD can't display.
|
||||
```arduino
|
||||
pinMode(5,OUTPUT);
|
||||
digitalWrite(5,HIGH);
|
||||
m5.begin();
|
||||
```
|
||||
?> **Note** Because GPIO5 who has connected NSS pin of LoRa module need be pull-up
|
||||
at the moment your board(or system) power on to prevent system's LCD
|
||||
can't display.
|
||||
|
||||
## Example
|
||||
|
||||
### Arduino IDE
|
||||
|
||||
This is point-to-point communication example between two LORA modules. One is transmitter, another is receiver.
|
||||
|
||||
*If you want the complete code, please click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LORA/Arduino)*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
#include <M5LoRa.h>
|
||||
|
||||
// declaration
|
||||
static uint32_t counter;
|
||||
|
||||
// initialization
|
||||
// override the default CS, reset, and IRQ pins (optional)
|
||||
LoRa.setPins(); // default set CS, reset, IRQ pin
|
||||
M5.Lcd.println("LoRa Sender");
|
||||
// frequency in Hz (433E6, 866E6, 915E6)
|
||||
LoRa.begin(433E6);
|
||||
|
||||
// send data
|
||||
LoRa.beginPacket();
|
||||
LoRa.print("hello ");
|
||||
LoRa.print(counter);// lora send data
|
||||
LoRa.endPacket();
|
||||
```
|
||||
|
||||
```arduino
|
||||
/*
|
||||
LoRaReceiver.ino
|
||||
*/
|
||||
#include <M5Stack.h>
|
||||
#include <M5LoRa.h>
|
||||
|
||||
// initialization
|
||||
M5.begin();
|
||||
// override the default CS, reset, and IRQ pins (optional)
|
||||
LoRa.setPins();// default set CS, reset, IRQ pin
|
||||
// frequency in Hz (433E6, 866E6, 915E6)
|
||||
LoRa.begin(433E6);
|
||||
|
||||
// try to parse packet
|
||||
int packetSize = LoRa.parsePacket();
|
||||
if (packetSize) {
|
||||
// read packet
|
||||
while (LoRa.available()) {
|
||||
char ch = (char)LoRa.read();
|
||||
M5.Lcd.print(ch);
|
||||
}
|
||||
// print RSSI of packet
|
||||
M5.Lcd.print("\" with RSSI ");
|
||||
M5.Lcd.println(LoRa.packetRssi());
|
||||
}
|
||||
```
|
||||
|
||||
<img src="assets/img/product_pics/module/module_example/LORA/example_module_lora_01.png">
|
||||
+1
-3
@@ -24,9 +24,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)
|
||||
|
||||
|
||||
@@ -45,4 +45,9 @@
|
||||
|
||||
https://github.com/m5stack/M5-Schematic/blob/master/Core/hardware_diff_between_m5cores.md
|
||||
|
||||
- Q. USB插入Core之后,识别不到串口号?
|
||||
- A. 这些Core主要区别在内部硬件配置和套件搭配上,从基础版到升级版,分别是增加了运动传感器和加大了RAM和FLASH,具体区别请访问这个链接
|
||||
|
||||
https://github.com/m5stack/M5-Schematic/blob/master/Core/hardware_diff_between_m5cores.md
|
||||
|
||||
--- -->
|
||||
@@ -47,10 +47,63 @@ M5Stack LoRa模块适用于长距离通信,结合多个LoRa模块,能组成
|
||||
m5.begin();
|
||||
```
|
||||
|
||||
<!-- ## 例程
|
||||
## 例程
|
||||
|
||||
### Arduino IDE -->
|
||||
### Arduino IDE
|
||||
|
||||
这是两个LORA模块点对点通信的例程,一个作为信号发射节点,一个作为信号接收节点。
|
||||
|
||||
*以下仅为用法示意,并不完整。如果需要完整例程请点击[这里](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/LORA/Arduino)*
|
||||
|
||||
```arduino
|
||||
#include <M5Stack.h>
|
||||
#include <M5LoRa.h>
|
||||
|
||||
// declaration
|
||||
static uint32_t counter;
|
||||
|
||||
// initialization
|
||||
// override the default CS, reset, and IRQ pins (optional)
|
||||
LoRa.setPins(); // default set CS, reset, IRQ pin
|
||||
M5.Lcd.println("LoRa Sender");
|
||||
// frequency in Hz (433E6, 866E6, 915E6)
|
||||
LoRa.begin(433E6);
|
||||
|
||||
// send data
|
||||
LoRa.beginPacket();
|
||||
LoRa.print("hello ");
|
||||
LoRa.print(counter);// lora send data
|
||||
LoRa.endPacket();
|
||||
```
|
||||
|
||||
```arduino
|
||||
/*
|
||||
LoRaReceiver.ino
|
||||
*/
|
||||
#include <M5Stack.h>
|
||||
#include <M5LoRa.h>
|
||||
|
||||
// initialization
|
||||
M5.begin();
|
||||
// override the default CS, reset, and IRQ pins (optional)
|
||||
LoRa.setPins();// default set CS, reset, IRQ pin
|
||||
// frequency in Hz (433E6, 866E6, 915E6)
|
||||
LoRa.begin(433E6);
|
||||
|
||||
// try to parse packet
|
||||
int packetSize = LoRa.parsePacket();
|
||||
if (packetSize) {
|
||||
// read packet
|
||||
while (LoRa.available()) {
|
||||
char ch = (char)LoRa.read();
|
||||
M5.Lcd.print(ch);
|
||||
}
|
||||
// print RSSI of packet
|
||||
M5.Lcd.print("\" with RSSI ");
|
||||
M5.Lcd.println(LoRa.packetRssi());
|
||||
}
|
||||
```
|
||||
|
||||
<img src="assets/img/product_pics/module/module_example/LORA/example_module_lora_01.png">
|
||||
|
||||
<!-- ## 原理图 -->
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
- 设置指纹识别比对等级
|
||||
|
||||
## 例程
|
||||
|
||||
### 1. Arduino IDE
|
||||
|
||||
## 原理图
|
||||
|
||||
<img src="assets/img/product_pics/unit/finger_sch.JPG">
|
||||
@@ -29,6 +33,10 @@
|
||||
<tr><td>FINGER指纹识别Unit</td><td>TXD</td><td>RXD</td><td>5V</td><td>GND</td></tr>
|
||||
</table>
|
||||
|
||||
<iframe width="560" height="315" src="http://player.youku.com/embed/XMzk5NjU4NjM3Ng==" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
## 相关视频
|
||||
|
||||
- **FINGER的演示**
|
||||
|
||||
<iframe height=498 width=510 src="http://player.youku.com/embed/XMzk5NjU4NjM3Ng==" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
<!-- <iframe height=498 width=510 src='http://player.youku.com/embed/XMzk5NjU4NjM3Ng==' frameborder=0 'allowfullscreen'></iframe> -->
|
||||
Reference in New Issue
Block a user