How to send Gps coordinates via Sim800l

Hello! I'm new in this project Sir @-dev....I want to ask on how to acquire adafruit ultimate gps coordinates via sim800l? And what library can I use? Thank You... I'd really appreciate your help thank you

What have you tried?

...R

Sorry for the late reply..here's my codes

#include <NeoSWSerial.h>
//#include <SoftwareSerial.h>
#include <AltSoftSerial.h>
// GPS
#include <TinyGPS.h>

// GSM
static const int RXPin = 8, TXPin = 9;
AltSoftSerial SIM900A(RXPin, TXPin);

NeoSWSerial mySerial(5, 6);
TinyGPS gps;

void setup()
{
Serial.begin(9600);
SIM900A.begin(9600);
SIM900A.println("AT+CNMI=2,2,0,0,0");
mySerial.begin(9600);
delay(1000);
}

void loop()
{
bool newdata = false;
String buffer = readSIM900A();
if(SIM900A.available() > 0)
Serial.println(SIM900A.read());
if (buffer.startsWith("\r\n+CMT: "))
{
// printing the number
Serial.println(buffer.substring(9, 22));

// Remove first 51 characters
// buffer.remove(0, 51);
int len = buffer.length();
// Remove \r\n from tail
// buffer.remove(len - 2, 2);
// printing message
Serial.println(buffer.substring(51, len-2));
if (buffer.substring(51, len-2) == "location")
{
Serial.println("Sending location");

// GPS
if (mySerial.available())
{
char c = mySerial.read();
if (gps.encode(c))
{
newdata = true;
}
}
if (newdata)
{
long int lat, lon;
unsigned long age, age1, date, time, chars;

gps.get_position(&lat, &lon, &age);
gps.get_datetime(&date, &time, &age);
Serial.print("Lat/Long(10^-5 deg): ");
Serial.print(lat);
Serial.print(", ");
Serial.print(lon);
Serial.print(" Fix age: ");
Serial.print(age); Serial.println("ms.");

Serial.print("Date(ddmmyy): "); Serial.print(date); Serial.print("
Time(hhmmsscc): ");
Serial.print(time);
Serial.print(" Fix age: "); Serial.print(age);
Serial.println("ms.");

Serial.print("Alt(cm): "); Serial.print(gps.altitude());
Serial.print(" Speed(mps): "); Serial.print(gps.f_speed_mps());

// setting GSM module
SIM900A.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
// sending location from which code word had come
SIM900A.println("AT+CMGS="" + buffer.substring(9, 22) + ""\r"); //
Replace x with mobile number
Serial.println("AT+CMGS="" + buffer.substring(9, 22) + ""\r");
delay(1000);

SIM900A.print("Lat/Long(10^-5 deg): ");
SIM900A.print(lat);
SIM900A.print(", ");
SIM900A.print(lon);
SIM900A.print(" Fix age: ");
SIM900A.print(age); SIM900A.println("ms.");

SIM900A.print("Date(ddmmyy): "); SIM900A.print(date);
SIM900A.print(" Time(hhmmsscc): ");
SIM900A.print(time);
SIM900A.print(" Fix age: "); SIM900A.print(age);
SIM900A.println("ms.");

SIM900A.print("Alt(cm): "); SIM900A.print(gps.altitude());
SIM900A.print(" Speed(mps): "); SIM900A.print(gps.f_speed_mps());

SIM900A.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
}
}
delay(100);
}

String readSIM900A()
{
String buffer;

while (SIM900A.available())
{
char c = SIM900A.read();
buffer.concat(c);
delay(10);
}

return buffer;
}

Please describe in detail what happens when you run your program and what you want it to do that is different.

Also to make it easy for people to help you please modify your post and use the code button </>
codeButton.png

so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to my text editor. The text editor shows line numbers, identifies matching brackets and allows me to search for things like all instances of a particular variable or function.

And please use the AutoFormat tool to indent your code for easier reading.

...R

#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

SoftwareSerial gpsSerial(8,7);
SoftwareSerial phoneSerial(5,6);

Adafruit_GPS GPS(&gpsSerial);

// Don't require echo
#define GPSECHO false

// Using interrupt
boolean usingInterrupt = true;
void useInterrupt(boolean);

void setup()
{
  //Serial.begin(115200); // Connect with Serial monitor to debug
  Serial.println("Adafruit GPS library basic test!");
  
  GPS.begin(9600);
  
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
  GPS.sendCommand(PGCMD_ANTENNA);
  
  useInterrupt(true);
  
  delay(2000);
  
  while (true) {
    Serial.print("Starting logging....");
    if (GPS.LOCUS_StartLogger()) {
      Serial.println(" STARTED!");
      break;
    } 
    else {
      Serial.println(" no response :(");
    }
  }
  
  delay(1000);
  
}

SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
  #ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 
  #endif
}

void useInterrupt(boolean v) {
  if (v) {

    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    TIMSK0 &= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint8_t state = 1;

uint32_t start_phone = 0UL;
uint32_t phone_timer  = 0UL;

void loop()
{
  if (GPS.newNMEAreceived()) {
    if (GPS.parse(GPS.lastNMEA())) {
      if (millis() > start_phone) {
        if (millis() - phone_timer > 300000)  {  // 5 minutes   
          gpsSerial.end();
          phoneSerial.begin(4800);
          
          for (int i = 0; i < 3; i++)  {    
            phoneSerial.begin(4800);
            delay(5000);
            Serial.print("Sending text");
            phoneSerial.println("AT"); // Sends AT command to wake up cell phone
            phoneSerial.flush();
            delay(500);
            phoneSerial.println("AT+CMGF=1"); // Puts phone into SMS mode
            phoneSerial.flush();
            delay(1000); // Wait a second
            phoneSerial.println("AT+CMGW=\"+10123456789\""); // YOUR NUMBER HERE; Creates new message to number
            phoneSerial.flush();
            delay(1000);
            phoneSerial.print("\nLocation (in degrees, works with Google Maps): ");
            phoneSerial.print(GPS.latitudeDegrees, 4);
            phoneSerial.print(", "); 
            phoneSerial.print(GPS.longitudeDegrees, 4);
            phoneSerial.flush();
            delay(1000);
            phoneSerial.write(byte(26)); // (signals end of message)
            phoneSerial.flush();
            delay(1000);
            phoneSerial.println("AT+CMSS=1"); // Sends message at index of 1
            phoneSerial.flush();
            Serial.println("Sent");
            delay(10000); // Give the phone time to send the SMS
            phoneSerial.println("AT+CMGD=1"); // Deletes message at index of 1
            phoneSerial.flush();
            delay(250);
      
            Serial.flush(); // waits for this state to completely finish up
            phoneSerial.flush();
          }
          
          phoneSerial.end();
          
          phone_timer = millis();
          gpsSerial.begin(9600);
          
        }
      }
    }
  }
}

That is the other code that I've tried and here is the result but the problem is that I didn't receive any message

Please display your image(s) in your post so we can see it(them) without downloading it(them). See this Simple Image Upload Guide

And (just in case) please don't post images of text, just copy and paste the text.

Please also respond to the first request in Reply #3

...R