How to get data from sensors separately in the Lora receiver?? #623
Unanswered
Calamardin
asked this question in
Q&A
Replies: 2 comments 3 replies
-
First, you should use a data format like Cayenne LPP. The examples in this library are for LoRaWAN, but the principle is the same, regardless of how you send the data. The decode example show how to transform a Cayenne data packet into a JSON object. |
Beta Was this translation helpful? Give feedback.
1 reply
-
In case anyone is having the same question send your data like this separated by comma
Then split the string in how much parts you need `
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, I have a question about how to separately obtain the data sent by various sensors and then assign them to different variables. Yes, for example I put a temperature sensor and a gas sensor in the same package and send it (I include a small code fragment in the transmitter)
LoRa.print(mySensor.CO2);
LoRa.print(",");
LoRa.print(mySensor.TVOC);
LoRa.print(",");
And in the receiver I get everything together with the following instructions:
void onReceive(int packetSize) {
for (int i = 0; i < packetSize; i++) {
Serial.print((char)LoRa.read());
How can I get the CO2 value on the one hand, the temperature on the other, etc. to assign each value to a variable and then use it, for example, to send it via mqtt?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions