tp0
This commit is contained in:
32
tp0/LoRaReceiver/LoRaReceiver.ino
Normal file
32
tp0/LoRaReceiver/LoRaReceiver.ino
Normal file
@ -0,0 +1,32 @@
|
||||
#include <SPI.h>
|
||||
#include <LoRa.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
while (!Serial);
|
||||
|
||||
Serial.println("Applejack is best pony ! Received by Pauline Srifi ~");
|
||||
|
||||
if (!LoRa.begin(864E6)) {
|
||||
Serial.println("Starting LoRa failed!");
|
||||
while (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// try to parse packet
|
||||
int packetSize = LoRa.parsePacket();
|
||||
if (packetSize) {
|
||||
// received a packet
|
||||
Serial.print("Received packet '");
|
||||
|
||||
// read packet
|
||||
while (LoRa.available()) {
|
||||
Serial.print((char)LoRa.read());
|
||||
}
|
||||
|
||||
// print RSSI of packet
|
||||
Serial.print("' with RSSI ");
|
||||
Serial.println(LoRa.packetRssi());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user