Documentation Center
This is the exact code snippet in formatting the Latitude data of the
Another important part of the code is configuring the size of the payload.
This is done on the
m_lora_app_data.buffsize
variable. For illustration above with only ilat as the value to
send, you need to set the buffer size to 5 because the array starts from 0 up to 4.
Decoding the Payload on the LoRaWAN Network Server
On the LoRaWAN network server side like TTN, Chirpstack, Helium, etc., the value transmitted can be retrieved
via decoding the payload.
Important Function in the LoRaWAN Example.
LoRa periodic transmission function should be very short and all reading and processing of the data must be in the
main loop.
The same with the transmission function, the receiving event handler should be short as well. All processing of the
received data should be in the main loop.
Uploading the LoRaWAN Code
After all the configuration is done and the payload is already formatted properly, you can now compile and upload
the code.
gps.f_get_position(&flat, &flon, &age);
flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat;
ilat = flat * 100000;
// longitude section...
m_lora_app_data.port = gAppPort;
m_lora_app_data.buffer[0] = 0x09;
//lat data
m_lora_app_data.buffer[1] = (ilat & 0xFF000000) >> 24;
m_lora_app_data.buffer[2] = (ilat & 0x00FF0000) >> 16;
m_lora_app_data.buffer[3] = (ilat & 0x0000FF00) >> 8;
m_lora_app_data.buffer[4] = ilat & 0x000000FF;
m_lora_app_data.buffsize = 5;
latitude_int = (bytes[1] << 24) | (bytes[2] << 16) | (bytes[3] << 8) | (bytes[4]);
decoded.latitude = latitude_int / 100000;
void tx_lora_periodic_handler(void)
void lorawan_rx_handler(lmh_app_data_t *app_data)