Skip to main content
added 288 characters in body
Source Link
Majenko
  • 105.9k
  • 5
  • 82
  • 139
#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);
      }
  }
     

  }
}

}

} }

#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);

  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);
  }

}

} }

#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);


    

      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);
      }
  }
     

  }
}
Source Link

Error while compiling

I made a code which can send the message to the entered phone number while it receieves a specific message or when the push button is pressed. but it is showing the error that 'smsReceivingFunction' was not declared in this scope. I'm a beginner and don't know what i'm doing wrong.

to know the working of functions of library-- http://1sheeld.com/docs/sms/#example

here is the code--

#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);

  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);
  }

}

} }