Jasmeet Singh
Published © CC BY-NC-SA

Location Alert to Caller

Send your location to the caller via SMS

EasyShowcase (no instructions)1,375
Location Alert to Caller

Things used in this project

Story

Read more

Code

LocAlert.ino

C/C++
// https://www.google.co.in/map/@28.6267793,77.0737148

#define CUSTOM_SETTINGS
#define INCLUDE_GPS_SHIELD
#define INCLUDE_PHONE_SHIELD
#define INCLUDE_SMS_SHIELD
#define INCLUDE_TERMINAL_SHIELD

#include <OneSheeld.h>
String number, msg;
char lati[11],longi[11];
boolean count=false;

void setup()
{
  OneSheeld.begin(); 
}
void loop()
{
  if(Phone.isRinging()) // once the phone starts ringing
  {
    number = Phone.getNumberAsString(); // store the number
    Terminal.println("Phone Ringing");
    delay(2000);
    count=true;
  }
  if(!Phone.isRinging() && count==true) // once the phone starts ringing
  {
    Terminal.println("Ringing Stopped");
    msg="I am at this location, if urgent, meet me @ www.google.co.in/maps/@";
    msg += dtostrf(GPS.getLatitude(), 10, 7, lati);
    msg += ",";
    msg += dtostrf(GPS.getLongitude(), 10, 7, longi);
    msg += " or call back later. ";
    SMS.send(number,msg);  // Send SMS with location
    msg += number;
    Terminal.println(msg);
    msg="";
    delay(10000);
    count=false;
   }
}

Credits

Jasmeet Singh

Jasmeet Singh

2 projects • 8 followers
I am the founder of JMoon Technologies(http://JMoon.co), RoboRium(http://RoboRium.com) and JMoon L.A.B.S. & MakerSpace (http://JMoonLabs.com/MakerSpace)
Contact

Comments