Hi there,
Now I have Blynk up and running finally (thanks to Pete [https://community.blynk.cc/u/peteknight/] for that!) I’m trying out a few things here and then and have become a little stumped on something so was wondering if someone could possibly help at all?
I have a very simple Blynk App on my iPhone which is using the GPS Stream widget to send GPS data across to my Arduino. This all works fine and I can use some simple code to retrieve that data :
BLYNK_WRITE(V2)
{
GpsParam gps(param);
// Print 6 decimal places for Lat
Serial.println(gps.getLat(), 7);
Serial.println(gps.getLon(), 7);
Serial.println(gps.getAltitude(), 2);
Serial.println(gps.getSpeed(), 2);
}
Apologies that I’ve just shown part of the code instead of the whole Arduino sketch but everything else is working fine and just need help with this little bit.
I then added the Map widget to the iPhone App (map is set to V10) and tried to do this :
BLYNK_WRITE(V2)
{
GpsParam gps(param);
// Print 6 decimal places for Lat
Serial.println(gps.getLat(), 7);
Serial.println(gps.getLon(), 7);
Serial.println(gps.getAltitude(), 2);
Serial.println(gps.getSpeed(), 2);
/* Send GPS Co-ordinates to Blynk to show on map in iPhone App */
int index = 0;
float lat = (gps.getLat(), 7);
float lon = (gps.getLon(), 7);
Serial.println("LATITUDE = ");
Serial.println(lat);
Serial.println("LONGITUDE = ");
Serial.println(lon);
Blynk.virtualWrite(V10, index, lat, lon, "value");
}
When I check the serial monitor (after uploading the sketch to my board) I get this shown :
LATITUDE =
7
LONGITUDE =
7
instead of the same lat and lon values that showed up in the code that just prints them to the monitor. Not too sure where the 7 is coming from as I thought it would set them to the same as what the GPS widget is spitting out?
I know this is a bit of a silly example as I’m literally sending the GPS data from my phone via the Blynk app to the Arduino and then (trying) to send the GPS values back again to the iPhone to display them on the map but once I get it all working I’d like to then obviously add a GPS module to the Arduino so that it can get GPS co-ordinates itself and send those off. This is just to see how it all works but I don’t seem to be able to get the data which is being sent from the App into a format that I can then send it back again.
Many thanks for any help with this.
Best wishes,
Mark