New Homepage Forums Communication Shields GPS/SMS sheild

This topic contains 0 replies, has 1 voice, and was last updated by avatar shaik 2 months, 2 weeks ago. This post has been viewed 43 times

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #291115
    avatarshaik
    Participant

    Hello, sir, I am trying to make a project where I want to send a message to the 1sheeld and the 1sheeld will reply to me with a message with the GPS coordinates

    my code is mentioned below

    //1sheeld.cm for the steps on adding the libraries to your arduino program
    #define CUSTOM_SETTINGS
    #define INCLUDE_SMS_SHIELD
    #define INCLUDE_GPS_SHIELD
    const char* gps = “gps”;
    float lat ;
    float lon ;
    boolean flag1 = false;
    boolean flag2 = false;
    boolean flag3 = false;
    char charlat [12];
    char charlon [12];
    char readings [80];

    #include <OneSheeld.h>

    int ledPin = 13; // choose the pin for the LED
    int inputPin = 2; // choose the input pin (for PIR sensor)
    int PIR = LOW;
    int val = 0;

    void setup() {
    pinMode(ledPin, OUTPUT); // declare LED as output
    pinMode(inputPin, INPUT); // declare sensor as input
    OneSheeld.begin();

    }

    void loop(){
    val = digitalRead(inputPin); // read input value
    if (val == HIGH) { // check if the input is HIGH
    digitalWrite(ledPin, HIGH); // turn LED ON
    delay(150);

    if (PIR == LOW) {
    SMS.send(“050*******”,”THE CAR IS MOVING”);
    PIR = HIGH;

    }
    } else {
    digitalWrite(ledPin, LOW); // turn LED OFF

    if (PIR== HIGH){

    PIR = LOW;

    if(!strcmp(SMS.getSms(),gps))
    {if(!flag3)
    { lat = GPS.getLatitude();
    lon = GPS.getLongitude();
    dtostrf(lat, 11, 7, charlat);
    dtostrf(lon, 11, 7, charlon);
    strcat(readings,”latitude is : “);
    strcat (readings,charlat);
    strcat(readings,”\nLongitude is : “);
    strcat (readings,charlon);
    SMS.send(“050******”,(readings));
    flag3 = true;}}
    }
    }
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.