GPS+GSM+ARDUINO need to merge code

i wanna calculate the location in 2D " LAT , LONG" by GPS and send them by using GSM module with ardunio , i tried to get the location and i succeed by using TinyGPS library .. and i sent a SMS to my phone number .. i have the code for GPS & GSM they work separately but when i collect them there is no error but they don't work ,.. so i need to collect them to send the lat & long in sms to my phone number .... i use GSM module " SIM900 " and GPS type " skylab "

GPS code:

#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(9,8,7,6,5,4);
unsigned long fix_age;
SoftwareSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
void setup(){
  lcd.begin(16,4);
  GPS.begin(9600);
  Serial.begin(9600);
}
void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;
  gps.get_position(&lat, &lon, &fix_age);
  getGPS();
  Serial.print("Latitude : ");
  Serial.print(LAT/100000,7);
  Serial.print(" :: Longitude : ");
Serial.println(LON/100000,7);
  lcd.setCursor(4,0);
  lcd.print("latitude : ");
lcd.setCursor(4,1);
  lcd.print(LAT/100000,7);
  lcd.setCursor(0,2);
  lcd.print("longitude : ");
  lcd.setCursor(0,3);
  lcd.print(LON/100000,7);
}
void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}
bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}
void gpsdump(TinyGPS &gps)
{
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps();
  }
}

GSM_SMS code::

#include <SoftwareSerial.h>
SoftwareSerial SIM900(0,1);
 
void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  // give time to log on to network. 
}
 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}
 
void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"01018506234\"");                                     // recipient's mobile number, in international format
  delay(100);
  SIM900.println("Hello, world. This is a text message from an Arduino Uno.");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}
 
void loop()
{
    sendSMS();
  do {} while (1);
}

Software serial on pins 0,1? When the hardware serial is already there?

i have the code for GPS & GSM they work separately but when i collect them there is no error but they don't work ,.. so i need to collect them to

I assume you mean combine then not collect them.
We need to see the failed combined code but as @aarg said do not use software serial on pins 0 & 1.

aarg:
Software serial on pins 0,1? When the hardware serial is already there?

yeah this for connect GSM with arduino , where i connect GSM Tx with Arduino Rx and GSM Rx with Arduino Tx the gsm work with arduino without gps , and gps work with arduino without gsm , but when i use gps and gsm they don't work .. i need to get the latitude and longitude from gps then send them to mobile phone in SMS ?? is there any errors in the code ?? if there you can show me the error ??

Grumpy_Mike:
We need to see the failed combined code but as @aarg said do not use software serial on pins 0 & 1.

@Grumpy_Mike
this is the failed combined code it does no error but it doesn't work

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

LiquidCrystal lcd(9,8,7,6,5,4);
unsigned long fix_age;
SoftwareSerial GPS(2,3);
SoftwareSerial SIM900 (0,1);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  lcd.begin(16,4);
  GPS.begin(19200);
  Serial.begin(19200);
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  // give time to log on to network. 

}
void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;
  gps.get_position(&lat, &lon, &fix_age);
  getGPS();
  Serial.print("Latitude : ");
  Serial.print(LAT/100000,7);
  Serial.print(" :: Longitude : ");
Serial.println(LON/100000,7);
  lcd.setCursor(4,0);
  lcd.print("latitude : ");
lcd.setCursor(4,1);
  lcd.print(LAT/100000,7);
  lcd.setCursor(0,2);
  lcd.print("longitude : ");
  lcd.setCursor(0,3);
  lcd.print(LON/100000,7);
    sendSMS();
  do {} while (1);
}
void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}
bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}
void gpsdump(TinyGPS &gps)
{
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps();
  }
}

 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}
 
void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"01155662747\"");                                     // recipient's mobile      number, in international format
  delay(100);
  SIM900.println(LAT/100000,7);        // message to send
  SIM900.println(LON/100000,7);  
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}

As we have been saying you are using pins 0 & 1 for both software serial AND hardware serial at the same time. Do not do it.

but what about SMS code??

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"01155662747\"");                                     // recipient's mobile      number, in international format
  delay(100);
  SIM900.println(LAT/100000,7);        // message to send
  SIM900.println(LON/100000,7);  
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}

All the SIM900.print statements should be simply Serial.print. And you can not use any debug printing.
Remove any referance to SIM900 begin and software serial.

i understood you but i don't know how i can make it .. can you combine the code please , and show me the correct code ?? please

Ism3lawy:
can you combine the code please , and show me the correct code

Sorry but no. I have helped you but you need some one who writes code for money. Decide how much you want to pay and post in the gigs and collaboration.

I am not sure how you can say you can understand me and yet not do something so simple.