I have three ESP32 with Lora network. I send a message from one EspLora1 to EspLora2 and it works properly. Now, I'm trying to get this data from EspLora2, make some treatments and send this new data to EspLora3. But, when I try this (EspLora2 to EspLora3), sometimes I get this data, but sometimes I does not get this data.
The codes is: In EspLora1, I send the message to LoRa network like this:
Code: Select all
LoRa.beginPacket();
LoRa.print("Some message here!!!");
LoRa.endPacket();
Code: Select all
int packetSize = LoRa.parsePacket();
if (packetSize > 0){
while(LoRa.available()){
received += (char) LoRa.read();
}
//Some codes here!!!
//Some tratments here!!!
}
Code: Select all
LoRa.beginPacket();
LoRa.print("Another message here!!!");
LoRa.endPacket();
Code: Select all
int packetSize = LoRa.parsePacket();
if (packetSize > 0){
while(LoRa.available()){
received += (char) LoRa.read();
}
//Another codes here!!!
//Some others tratments here!!!
}
I noticed that to send message from EspLora2 to EspLora3, if I put the message into a string variable and to do
Code: Select all
"LoRa.print(variableWithMessage)"
Code: Select all
"LoRa.write((unsigned char *)&"someMessageHere",sizeof("someMessageHere"))"
Can someone help me to manage to figure out this puzzle???