#include <OneSheeld.h>
float lat ; float lon ; char charlat [30]; char charlon [30]; char readings [150]; int buttonPin=11; int ledPin=12;
void setup() { // put your setup code here, to run once: OneSheeld.begin(); /* Set the button pin as input. / pinMode(buttonPin,INPUT); / Set the LED pin as output. */ pinMode(ledPin,OUTPUT); SMS.setOnSmsReceive(&smsReceivingFunction); }
void loop()
{ charlat[0] = 0; charlon[0] = 0; readings [0] = 0; if(digitalRead(buttonPin) == HIGH) { /* Turn on the LED. */ digitalWrite(ledPin,HIGH); delay( 1000); digitalWrite(ledPin,HIGH); delay( 500);
float lat ;
float lon ;
char charlat [30];
char charlon [30];
char readings [150];
int buttonPin=11;
int ledPin=12;
void setup() {
// put your setup code here, to run once:
OneSheeld.begin();
/* Set the button pin as input. */
pinMode(buttonPin,INPUT);
/* Set the LED pin as output. */
pinMode(ledPin,OUTPUT);
SMS.setOnSmsReceive(&smsReceivingFunction);
}
void loop()
{
charlat[0] = 0;
charlon[0] = 0;
readings [0] = 0;
if(digitalRead(buttonPin) == HIGH)
{
/* Turn on the LED. */
digitalWrite(ledPin,HIGH);
delay( 1000);
digitalWrite(ledPin,HIGH);
delay( 500);
lat = GPS.getLatitude();
lon = GPS.getLongitude();
dtostrf(lat, 3, 7, charlat);
dtostrf(lon, 3, 7, charlon);
strcat(readings, "please call me I i do not pick up the call please reach to my location:\n");
strcat(readings, "http://maps.google.com/maps?q=");
strcat (readings, charlat);
strcat(readings, ",");
strcat (readings, charlon);
SMS.send("+917771914436", readings);
void smsReceivingFunction(const char * number,const char * text);
if(!strcmp(number,"+7771914436")) /* phone number from which you will send the sms "PUT YOURS IN PLACE OF +1234567890" */
{
if(!strcmp(text,"?"))
lat = GPS.getLatitude();
lon = GPS.getLongitude();
dtostrf(lat, 3, 7, charlat);
dtostrf(lon, 3, 7, charlon);
strcat(readings, "please call me I i do not pick up the call please reach to my location:\n");
strcat(readings, "http://maps.google.com/maps?q=");
strcat (readings, charlat);
strcat(readings, ",");
strcat (readings, charlon);
SMS.send("+917771914436", readings);
}
}
}
}
}
} }