Sim800L send multiple data failed

I am using sim800l with arduino nano, with the library named “SIm800L Library revised” available on internet with the example “sendSMS” example given

#include <Sim800L.h>
#include <SoftwareSerial.h>               

#define RX  10
#define TX  11

Sim800L GSM(RX, TX);

/*
 * In alternative:
 * Sim800L GSM;                       // Use default pinout
 * Sim800L GSM(RX, TX, RESET);        
 * Sim800L GSM(RX, TX, RESET, LED);
 */

char* text;
char* number;
bool error; 					//to catch the response of sendSms


void setup(){
	GSM.begin(4800); 			
	text="Testing Sms";  		//text for the message. 
	number="2926451386"; 		//change to a valid number.
	error=GSM.sendSms(number,text);
	
	// OR 
	//Sim800L.sendSms("+540111111111","the text go here")

}

void loop(){
	//do nothing
}

this code works fine with the text. but now i want to send multiple data in single sms
i am using GPS module with TinyGPS++ library for lat and long. this gives me data in following format
gps.location.lat();
gps.location.lng();
when i convert these into strings with
dtostrf(gps.location.lat(),2,4,latString);
dtostrf(gps.location.lng(),2,6,lonString);

and then sending sms
GSM.sendSms(number,latString);
example of this GPS is given

#include <TinyGPS++.h>
#include <SoftwareSerial.h>

/*
   This sample demonstrates TinyGPS++'s capacity for extracting custom
   fields from any NMEA sentence.  TinyGPS++ has built-in facilities for
   extracting latitude, longitude, altitude, etc., from the $GPGGA and 
   $GPRMC sentences.  But with the TinyGPSCustom type, you can extract
   other NMEA fields, even from non-standard NMEA sentences.

   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(RX) and 3(TX).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

/*
   By declaring TinyGPSCustom objects like this, we announce that we
   are interested in the 15th, 16th, and 17th fields in the $GPGSA 
   sentence, respectively the PDOP (F("positional dilution of precision")),
   HDOP (F("horizontal...")), and VDOP (F("vertical...")).

   (Counting starts with the field immediately following the sentence name, 
   i.e. $GPGSA.  For more information on NMEA sentences, consult your
   GPS module's documentation and/or http://aprs.gids.nl/nmea/.)

   If your GPS module doesn't support the $GPGSA sentence, then you 
   won't get any output from this program.
*/

TinyGPSCustom pdop(gps, "GPGSA", 15); // $GPGSA sentence, 15th element
TinyGPSCustom hdop(gps, "GPGSA", 16); // $GPGSA sentence, 16th element
TinyGPSCustom vdop(gps, "GPGSA", 17); // $GPGSA sentence, 17th element

void setup() 
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("UsingCustomFields.ino"));
  Serial.println(F("Demonstrating how to extract any NMEA field using TinyGPSCustom"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop() 
{
  // Every time anything is updated, print everything.
  if (gps.altitude.isUpdated() || gps.satellites.isUpdated() ||
    pdop.isUpdated() || hdop.isUpdated() || vdop.isUpdated())
  {
    Serial.print(F("ALT="));   Serial.print(gps.altitude.meters()); 
    Serial.print(F(" PDOP=")); Serial.print(pdop.value()); 
    Serial.print(F(" HDOP=")); Serial.print(hdop.value()); 
    Serial.print(F(" VDOP=")); Serial.print(vdop.value());
    Serial.print(F(" SATS=")); Serial.println(gps.satellites.value());
  }

  while (ss.available() > 0)
    gps.encode(ss.read());
}

individually its working fine but now i want to merge these data’s, the format i want to send is
"Lat="0000\n
"Long="0000\n
in single sms

i have tried many methods but with no luck. anyone can help me to Solve this problem

trm33:
I am using sim800l with arduino nano, with the library named "SIm800L Library revised" available on internet with the example "sendSMS" example given

Please provide a link to the library.

trm33:
this code works fine with the text. but now i want to send multiple data in single sms
i am using GPS module with TinyGPS++ library for lat and long. this gives me data in following format
gps.location.lat();
gps.location.lng();

This is not a format but rather two function calls.

trm33:
individually its working fine but now i want to merge these data's, the format i want to send is
"Lat="0000\n
"Long="0000\n
in single sms

i have tried many methods but with no luck. anyone can help me to Solve this problem

What methods have you tried? What was the reason for them not to work?

void setup()
{
    // initialize gms
    // initialize gps
}

void loop()
{
    // is gps reading available?
        // update internal variables
        // format sms text
        // send sms
    // is serial available?
        // do serial stuff
}

LightuC:
Please provide a link to the library.
This is not a format but rather two function calls.

What methods have you tried? What was the reason for them not to work?

void setup()

{
    // initialize gms
    // initialize gps
}

void loop()
{
    // is gps reading available?
        // update internal variables
        // format sms text
        // send sms
    // is serial available?
        // do serial stuff
}

Library is available in library manager of arduino IDE with the name "SIm800l library revised"

these functions are converted into string they individually work fine
gps.location.lat();
gps.location.lng();
dtostrf(gps.location.lat(),2,4,latString);
dtostrf(gps.location.lng(),2,6,lonString);

if i use latSTring and LonString individually works fine
i have tried the following method to merg
String multi="LAT=";
multi +=latString;
multi +="Longi=";
multi +=lonString;
multi+=String(\r\n);

if there is data type mistake then plz correct it or if u have another merging technique then plz send

trm33:
if i use latSTring and LonString individually works fine
i have tried the following method to merg
String multi="LAT=";
multi +=latString;
multi +="Longi=";
multi +=lonString;
multi+=String(\r\n);

if there is data type mistake then plz correct it or if u have another merging technique then plz send

Please also use code-tags for short snippets.

What exactly is not working with that example? Apart from the obvious error (missing "" in last line) this will work. However, I would strongly recommend against using big-s String class.

You can use this method:

/*---------------------------------------------------------------------------------------
   Name:        prepareSMSText
   
   Purpose:     This function converts the latitude and longitude arguments to a formated
                sms text. The format is given by 'Lat=-00.0000\nLong=-000.0000\n'.

   Arguments:   'smsBuffer' a pointer to a char array with a minimum size of 29 bytes
                'latitude' the latitude to put into the sms text
                'longitude' the longitude to put into the sms text
                
   Assumptions: 'latitude' is assumed to be in range of [-90, 90]
                'longitude' is assumed to be in range of [-180, 180]
                
   Notes:       No leading zeros are added and for positive numbers no plus sign is added.
                The content 'smsBuffer' can therefore vary from 'Lat=0.0000\nLong=0.0000\n'
                to 'Lat=-00.0000\nLong=-000.0000\n'. There will always be four decimal
                places.
---------------------------------------------------------------------------------------*/
void prepareSMSText(char* smsBuffer, double latitude, double longitude)
{
  char* insertionPtr = smsBuffer;

  // Put first text into buffer
  strncpy(insertionPtr, "Lat=", 4);
  insertionPtr += 4;

  // Convert latitude and store it in buffer
  dtostrf(latitude, 6, 4, insertionPtr);
  uint8_t textLength = strlen(smsBuffer);
  insertionPtr = &smsBuffer[textLength];

  // Insert second text into buffer
  strncpy(insertionPtr, "\nLong=", 6);
  insertionPtr += 6;

  // Convert longitude and store it in buffer
  dtostrf(longitude, 6, 4, insertionPtr);
  textLength = strlen(smsBuffer);
  insertionPtr = &smsBuffer[textLength];

  // Add last '\n' and terminate string
  *insertionPtr++ = '\n';
  *insertionPtr = '\0';
}