LoRaGateway_BTS2A/LoRa_test/LoRaReceiver/LoRaReceiver.ino

29 lines
516 B
Arduino
Raw Normal View History

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-04-12 14:55:36 +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) {
for (int i = 0; i < packetSize; i++)
{
SerialUSB.println((char)LoRa.read());
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-04-12 14:55:36 +02:00
2018-03-27 17:00:33 +02:00
}