2018-03-27 17:00:33 +02:00
|
|
|
#include <SPI.h>
|
|
|
|
#include <LoRa.h>
|
|
|
|
|
|
|
|
void setup() {
|
2018-04-12 14:55:36 +02:00
|
|
|
SerialUSB.begin(9600);
|
|
|
|
while (!SerialUSB){};
|
|
|
|
SerialUSB.println("LoRa Receiver");
|
2018-03-27 17:00:33 +02:00
|
|
|
|
2018-05-23 08:55:25 +02:00
|
|
|
if (!LoRa.begin(868E6)) {
|
|
|
|
Serial.println("Starting LoRa failed!");
|
|
|
|
while (1);
|
|
|
|
}
|
2018-03-27 17:00:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
int packetSize = LoRa.parsePacket();
|
2018-04-12 14:55:36 +02:00
|
|
|
if (packetSize > 0) {
|
2018-05-23 08:55:25 +02:00
|
|
|
SerialUSB.println("Nouveau paquet");
|
|
|
|
for (int i = 0; i < packetSize; i++)
|
2018-04-12 14:55:36 +02:00
|
|
|
{
|
2018-05-23 08:55:25 +02:00
|
|
|
SerialUSB.println(LoRa.read(),HEX);
|
2018-03-27 17:00:33 +02:00
|
|
|
}
|
2018-04-12 14:55:36 +02:00
|
|
|
//Serial.print("with RSSi");
|
2018-03-27 17:00:33 +02:00
|
|
|
//Serial.println(LoRa.packetRssi());
|
2018-04-12 14:55:36 +02:00
|
|
|
delay(100);
|
2018-03-27 17:00:33 +02:00
|
|
|
}
|
2018-05-23 08:55:25 +02:00
|
|
|
//SerialUSB.println("");
|
2018-03-27 17:00:33 +02:00
|
|
|
}
|