I’m trying to send a time packet to the things network. I’m doing this by using a NEO-6M GPS, with the Adafruit_GPS library. However, say the time was 19:39:40, it will come back as this:
Not entirely sure why it’s doing this, as the serial monitor outputs the correct time.
I have combined the GPS.hour, GPS.minutes and GPS.seconds together like this:
timePacket = packetHour + packetMinute + packetSeconds;
uint32_t timeSend = stringToUint(timePacket);
uint32_t timePayload = timeSend;
I use a function to turn the data type from String to Long or uint32_t:
uint32_t stringToUint(String s) {
char arr[7];
s.toCharArray(arr, sizeof(arr));
return atol(arr);
}
Here is the payload formatter:
function decodeUplink(input) {
var data = {};
var sensorDistance = (input.bytes[0] << 8) + input.bytes[1];
data.distance = sensorDistance;
return {
data: data,
};
}
I’m not entirely sure why it’s doing this, as all other data reads correct. Any help would be appreciated.