Problems to send message from ESP32 Lora to another
Posted: Tue Sep 22, 2020 10:43 pm
Hi.
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:
At the same time, in the EspLora2, I try to read this message like this (inside loop code).
Still in the EspLora2, after get the data from LoRa network, inside the "packetSize > 0" and after "while", if some condition is satisfy, I do like this code bellow to send this new message to LoRa network and consequently to EspLora3:
At the same time, in the EspLora3, I do like this to read this another new message generated by EspLora2 (inside loop code):
In this moment, when I try to read the data that arrive in the EspLora3, I can read the data generated by EspLora1 perfectly (of course, the EspLora1 also generate data to LoRa network). But, I don't know why, the data generated by EspLora2, sometimes I could read, but sometimes I could'n read. It's very strange situation.
I noticed that to send message from EspLora2 to EspLora3, if I put the message into a string variable and to do
it doesn't work at all. But also, if I put this message inside the code
it sometimes works (EspLora3 can read the message), but sometimes it doesn't work. Moreover, if I send a number (like a sequence count) from EspLora2 to EspLora3 it works perfectly. It's very very strange.
Can someone help me to manage to figure out this puzzle???
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???