Open AnandhaLakshmanan opened 2 years ago
I once had the same problem, if your sender is not connected to a serial device (i.e. your PC) the line
while (!Serial);
will halt your program. If you remove that it should work.
i did project with lora back then and everything is good, and i now i tried to use it again, i can't get any data from lora sender. i tried to change the arduino uno and the problem is the same. Is there any solution?
You don't set SF, BW, CR parameters, so they could be different on both devices.
You don't set SF, BW, CR parameters, so they could be different on both devices.
Thank you for your reply. If it's okay, can i have the example of what you meant by setting SF, BW, and CR parameters?
I am using two LoRa sx1278 with arduino uno boards. the sender node is working perfectly but the receiver doesn't show any received messages. LoRa initialization is okay in both receiver and sender.
sender code :
include
include
int counter = 0;
void setup() { Serial.begin(9600); while (!Serial);
Serial.println("LoRa Sender");
if (!LoRa.begin(433E6)) { Serial.println("Starting LoRa failed!"); while (1); } }
void loop() { Serial.print("Sending packet: "); Serial.println(counter);
// send packet LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket();
counter++;
delay(5000); }
Receiver code :
include
include
void setup() { Serial.begin(9600); while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(433E6)) { 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 '");
} }