Dear All,
Can you please help me with getting the location information from Google Geolocation API and Show location on Map widget in the Blynk app?
I am using Arduino Yun with iOS Blynk app.
https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY
#define BLYNK_PRINT Serial
#define BLYNK_MAX_READBYTES 4096
#include <Bridge.h>
#include <BlynkSimpleYun.h>
char auth[] = "4730d34a23444444818656b8424399b95a";
WidgetTerminal terminal(V1);
BLYNK_WRITE(V17)
{
String webhookdata = param.asStr();
yield();
if((webhookdata.length() > 1) && (webhookdata.length() < 4096)){
Serial.println("WebHook data:");
Serial.println(param.asStr());
Serial.print("Data size: ");
Serial.println(webhookdata.length());
terminal.println(webhookdata);
terminal.print("Data size: ");
terminal.println(webhookdata.length());
terminal.flush();
webhookdata = "";
yield();
}
else{}
Serial.println("Unknown problem");
terminal.print("Unknown problem");
Serial.println(webhookdata);
Serial.println(webhookdata.length());
}
}
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth);
// If you want to remove all points:
//myMap.clear();
//int index = 1;
//float lat = 41.9;
//float lon = 2.2;
myMap.location(index, lat, lon, "value");
}
void loop()
{
Blynk.run();
}
I am not sure how to get the webhook data from POST request and to assign lat and lon info to Map widget.
Any help is appreciated…