Hello,
I encounter problem when try to send lat and lng to ubidots. Im using arduino uno and gps module neo 6m. Based on my reading, we need to use context to send the value. I try to implement context but it does not work. Do anyone know the solution? Below is the part of of code that im using. Thank you in advance.
gps_latitude = gps.location.lat();
gps_longitude = gps.location.lng();
dtostrf(sensor1, 4, 2, str_sensor1);
dtostrf(gps_latitude, 4, 2, str_lat);
dtostrf(gps_longitude, 4, 2, str_lng);
/* Building the logger command */
sprintf(second_command, "init#");
sprintf(second_command, "%s%s/%s|%s|%s|", second_command, USER_AGENT, VERSION, METHOD, TOKEN);
sprintf(second_command, "%s%s:%s=>", second_command, DEVICE_NAME, DEVICE_LABEL);
sprintf(context, "lat=%.2f$lng=%.2f", str_lat ,str_lng);
sprintf(second_command, "%s%s:%s%s", second_command, VARIABLE_LABEL_2, str_lat, str_lng, context);
sprintf(second_command, "%s|end#final", second_command);
esp.print(second_command);
while (esp.available() > 0)
{
telemetry_unit[i++] = (char)esp.read();
/* Change the status of the flag; allows the next command to be built */
}
Serial.write(telemetry_unit);
i=0;
delay(5000);
Taking a look of the payload built by you in the code provided, I note that the structure is not the right one. If you desire to send a variable position with their respective coordinates the command ought to be:
im not familiar with the format. im newbies in creating this project. can you explain how the structure works. i have tried to compare and run the code. but it shows “lng?” in ubidots. what is it means by?? i think i still sending the wrong structure. thank you in advance and your help is much appreciated
In each page you will find all the information required to learn how the payload should be structured. If you have any additional question let us know.
As personal recommendation, you should print the payload to be sent in order to be able to compare it with the ones described in the guides, in this order you will be able to identify where can be the issue.