I need to format a Payload before I send it out via a UDP Broadcast.
I’ve used the Snprintf function before in the past with good success but on this new project I’m feeding the Snprintf function with data being held in a char array and I think it needs formatted maybe to work correctly.
The Array I’m pulling Data from is shown below.
Here is a note from the Library creator about pulling the data stored in this array which is in char format and not numbers or floats.
I’m creating a formatted Payload using code like shown below:
I’m wondering if I can just use the snprintf function and the %s formatting code to just use the Char data stored in the Array without needing to convert the data using the ATOI() & ATOF() functions? I do not need to do any math on the data before sending it out so not sure if the conversion from Char to Number is needed if I only need to send it out via a UDP Broadcast message.
So I’m thinking of formatting the payload using the %s for data stored in the Char format but I’m not sure just yet. Wanted some professional feedback on this if possible.