Sending a GPS location by SMS

Now that we have the location part working correctly, we can start building our GPS tracking projects for secret agents. The first project will simply use the location and send it via SMS to the phone number of your choice.

As the sketch is quite similar to previous one, I'll only show which parts changed compared to the location test sketch. We first need to define the phone number where you want to send the tracking data to:

char * sendToNumber = "123456789";

After getting the location just as in the previous section, we can now build the message that we will send via SMS:

char messageToSend[140]; String message = "Current GPS location: " + latitude + "," + longitude; message.toCharArray(messageToSend, message.length()); ...

Get Arduino: Building exciting LED based projects and espionage devices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.