Hi Guys, brand new here
I want to send sensor data in context with GPS coordinates to Ubidots. As “simulator”, I am hooking up a ESP8266 and while I can send sensor data just fine, the GPS context formatting is not working for me.
I follow this example and my code looks like the one below. I also tried this, no success.
"UbidotsMicroESP8266.h"
#define TOKEN "XX" // Put here your Ubidots TOKEN
#define WIFISSID "XCXC" // Put here your Wi-Fi SSID
#define PASSWORD "CCC" // Put here your Wi-Fi password
Ubidots client(TOKEN);
void setup(){
Serial.begin(115200);
client.wifiConnection(WIFISSID, PASSWORD);
}
void loop(){
float humid = random(0,30);
char context[25];
sprintf(context, "lat=53.2734$lng=-75.5812"); //Sends latitude and longitude for watching position in a map
Serial.println(context);
client.add("humidity", humid, context);
client.sendAll(true);
delay(5000);
}
The serial output is
lat=53.2734$lng=-75.5812
In the context of my device, I see
{“lat”:“53.2734”,“lng”:"-75.5812"}
and no display into the map.
It would be awesome if someone could just help with with the syntax of that sprintf line, I think that is where the issue lies - not sure why the guthub example doesn’t work…