This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include <M5Stack.h> | ||
#include <M5LoRa.h> | ||
|
||
|
||
void setup() { | ||
|
||
M5.begin(); | ||
|
||
// override the default CS, reset, and IRQ pins (optional) | ||
LoRa.setPins(); // default set CS, reset, IRQ pin | ||
Serial.println("LoRa Receiver"); | ||
M5.Lcd.println("LoRa Receiver"); | ||
|
||
// frequency in Hz (433E6, 866E6, 915E6) | ||
if (!LoRa.begin(433E6)) { | ||
Serial.println("Starting LoRa failed!"); | ||
M5.Lcd.println("Starting LoRa failed!"); | ||
while (1); | ||
} | ||
|
||
// LoRa.setSyncWord(0x69); | ||
Serial.println("LoRa init succeeded."); | ||
M5.Lcd.println("LoRa init succeeded."); | ||
} | ||
|
||
void loop() { | ||
// try to parse packet | ||
int packetSize = LoRa.parsePacket(); | ||
if (packetSize) { | ||
// received a packet | ||
Serial.print("Received packet: \""); | ||
M5.Lcd.print("Received packet: \""); | ||
|
||
// read packet | ||
while (LoRa.available()) { | ||
char ch = (char)LoRa.read(); | ||
Serial.print(ch); | ||
M5.Lcd.print(ch); | ||
} | ||
|
||
// print RSSI of packet | ||
Serial.print("\" with RSSI "); | ||
Serial.println(LoRa.packetRssi()); | ||
M5.Lcd.print("\" with RSSI "); | ||
M5.Lcd.println(LoRa.packetRssi()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <M5Stack.h> | ||
#include <M5LoRa.h> | ||
|
||
|
||
void setup() { | ||
|
||
M5.begin(); | ||
|
||
// override the default CS, reset, and IRQ pins (optional) | ||
LoRa.setPins(); // default set CS, reset, IRQ pin | ||
Serial.println("LoRa Sender"); | ||
M5.Lcd.println("LoRa Sender"); | ||
|
||
// frequency in Hz (433E6, 866E6, 915E6) | ||
if (!LoRa.begin(433E6)) { | ||
Serial.println("Starting LoRa failed!"); | ||
M5.Lcd.println("Starting LoRa failed!"); | ||
while (1); | ||
} | ||
|
||
// LoRa.setSyncWord(0x69); | ||
Serial.println("LoRa init succeeded."); | ||
M5.Lcd.println("LoRa init succeeded."); | ||
} | ||
|
||
void loop() { | ||
// try to parse packet | ||
static uint32_t counter; | ||
|
||
Serial.print("Sending packet: "); | ||
Serial.println(counter); | ||
|
||
// send packet | ||
LoRa.beginPacket(); | ||
LoRa.print("hello "); | ||
LoRa.print(counter); | ||
LoRa.endPacket(); | ||
|
||
counter++; | ||
|
||
delay(1000); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.