converting INT to Vector – sending data
- This topic has 0 replies, 1 voice, and was last updated 8 years, 12 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Hello,
It seems like all the mDot LoRa examples are sending static strings to the gateway. They all send this:
std::string data_str = "hello!";
How do you send data rather than static strings? Say, an int counter? I tried adding this code to the <mDot_LoRa_Connect_Example>, but I got empty payloads.
int32_t myCounter = 1;
std::vector<uint8_t> data;
...
myCounter++
data.push_back(myCounter);
data.push_back(myCounter >> 8);
data.push_back(myCounter >> 16);
data.push_back(myCounter >> 24);
[TRACE] MIC: cf1b4c3d RX_MIC: cf1b4c3d
[INFO] ACK Received
[TRACE] Empty payload
[INFO] successfully sent data to gateway
Eventually, I’d like to be able to assemble a JSON formatted LoRa packet with all the sensor data on the mDot, which would require concatenating strings and INT and floats. But as a step one, I’m looking at just converting a single int.