i need to receive int value to assign to variable in ESP #19
daeynasvistas
started this conversation in
General
Replies: 1 comment
-
Hi, if(LMIC.getPort() ==2 && LMIC.getDataLen() >1) {
auto data = LMIC.getData();
somevalue = data[0] + data[1] << 8;
} For the server side, I use TTN so I send the data from node-red and have it make the byte buffer and encode it in base64 to send the needed json to the server. I have to always check the order of the byte (big-endian or small-endian) For the other way (device -> server) I know this library : https://github.com/thesolarnomad/lora-serialization but I have never try it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ok, so when downlink data from NS server to node..
i need to convert value to Base64 (i use Chirpstack) then send it on Port 2 (as example, i can use API to)
I then need to retreive the value in node.
Example:
int value of "24156"
Convert to HEX: 24156 -> 0x5E5C
Convert HEX to Base64: 0x5E5C -> Xlw=
now send with chirpstack dashboard or API
Great...
now get that value with great LMICPP-Arduino
auto data = LMIC.getData(); // i get the my data...
but is there a better way ? i dont what to send text, so i need to convert HEX to base64 in first place..
but i need to receive int value to assign to variable in ESP.
can i get value "directly from data array?" or the method i use are ok?
many thanks.. :)
Beta Was this translation helpful? Give feedback.
All reactions