I am trying to upload longitude and latitude data into MySQK using a GPRS shield, Arduino Uno R3 and a GPS module. The idea is to get longitude and latitude data from the GPS and use the GPRS to post the information into my database.

I have to insert the latitude and longitude data into the URL like this steetalert.co.zw/write_data.php?Longitude=12.124311,Latitude=27,766785. Values for longitude and latitude have to be dynamic not static. How do I go about this?

  • 1
    This isn't really an appropriate place to ask people to write entire programs for you. Post the code you've got so far and explain where you're having trouble. – cjs Apr 20 '17 at 0:30

It looks like you need to know how to create a string that contains: steetalert.co.zw/write_data.php?Longitude=12.124311,Latitude=27,766785

Its quite easy (I think) try this:

const int cDecimalPlaces(6);
String szLon = String(fLongitude, cDecimalPlaces);
String szLat = String(fLatitude, cDecimalPlaces);
String szUrl = "steetalert.co.zw/write_data.php?Longitude=" + szLon ",Latitude=" + szLat;

Normally I would use sprint or a Format function, but I can't find those in the reference.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.