problem sim900 + tinygps with arduino mega 2560

I wanted to create a vehicle tracking for motorcycles, but I has an obstacle in arduino. how to combine GPS shield icomsat 1.1 + 1.1 with arduino mega 2560. I hope anyone can help me to bring the program

#include <SoftwareSerial.h>   //library untuk komunikasi serial
#include <String.h>
#include "SIM900.h"
#include "sms.h" 
SMSGSM sms;
#include <TinyGPS.h>
#include <SD.h>
#include <stdlib.h>
#include <SoftwareSerial.h>


// initialize the library with the numbers of the interface pins

TinyGPS gps;
static char dtostrfbuffer[20];
const int chipSelect = 53;
int LED = 13;

//Define String
String SD_date_time = "invalid";
String SD_lat = "invalid";
String SD_lon = "invalid";
String dataString ="";

static void gpsdump(TinyGPS &gps);
static bool feedgps();
static void print_float(float val, float invalid, int len, int prec, int SD_val);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

//--------------------------------------------------------//-------------------------
#define Rx 14
#define Tx 15
SoftwareSerial mySerial(Rx,Tx);//komunikasi serial untuk modul GSM

String msg = String("");
int SmsContentFlag = 0;
int sensor=26;//inputan digi sensor 
int ledPin=4;//indikator led sensor api
int relay_a=28;
int buttonState = 0;
int ind_kirim_sms =2;

int powergsm = 52;

void setup() {

  Serial.begin(9600);

   
   pinMode(53, OUTPUT);  //Chip Select Pin for the SD Card
   pinMode(LED, OUTPUT);  //LED Indicator
  
  //Connect to the SD Card
  if (!SD.begin(chipSelect))
  {
    return;
  }
  
//--------------------------------------------------------//-------------------------  
   
  mySerial.begin(19200);    // baudrate untuk GSM 
  delay(500);
  pinMode(relay_a, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(ledPin , OUTPUT );
  mySerial.println( "AT+CMGF=1" ); 
  delay(200);
  kirim_sms();
  }
  
 void loop(){

char SerialInByte;
        buttonState = digitalRead(sensor);
           if (buttonState == HIGH)                           // check apakah tombol pushbutton ditekan
           {  
             if (ind_kirim_sms > 0){
             kirim_sms();
             delay(200);
             }
           }
           else
           {
             digitalWrite(ledPin, LOW);                           // matikan LED (off)
           }
    if(Serial.available())
    {       
        SerialInByte = (unsigned char)Serial.read();
       delay(5);
        
        if( SerialInByte == 13 ){
          // EN: Store the char into the message buffer
          ProcessGprsMsg();
         }
         if( SerialInByte == 10 ){
            // EN: Skip Line feed
         }
         else {
           // EN: store the current character in the message string buffer
           msg += String(SerialInByte);
          
           
         }
     }

//--------------------------------------------------------//-------------------------

{
bool newdata = false;
  unsigned long start = millis();
  
  // Every second we print an update
  while (millis() - start < 1000)
  {
    if (feedgps())
      newdata = true;
  }
  
  gpsdump(gps);
  
  //Write the newest information to the SD Card
  dataString = SD_date_time + "," + SD_lat + "," + SD_lon;
  if (SD_date_time != "invalid")
    digitalWrite(LED, HIGH);
  else
    digitalWrite(LED, LOW);
    
  //Open the Data CSV File
  File dataFile = SD.open("LO1.csv", FILE_WRITE);
  if (dataFile)
  {
    dataFile.println(dataString);
 
 }
 }
}

static void gpsdump(TinyGPS &gps)
{
  float flat, flon;
  unsigned long age, date, time, chars = 0;
  unsigned short sentences = 0, failed = 0;
  static const float LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
  
  gps.f_get_position(&flat, &flon, &age); 
  print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 9, 5, 1); //LATITUDE
  print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 10, 5, 2); //LONGITUDE//  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);


  Serial.println();
}



static void print_float(float val, float invalid, int len, int prec, int SD_val)
{
  char sz[32];
  if (val == invalid)
  {
    strcpy(sz, "*******");
    sz[len] = 0;
        if (len > 0) 
          sz[len-1] = ' ';
    for (int i=7; i<len; ++i)
        sz[i] = ' ';
    Serial.print(sz);
    if(SD_val == 1) SD_lat = sz;
    else if(SD_val == 2) SD_lon = sz;
  }
  else
  {
    Serial.print(val, prec);
    if (SD_val == 1) SD_lat = dtostrf(val,10,5,dtostrfbuffer);
    else if (SD_val == 2) SD_lon = dtostrf(val,10,5,dtostrfbuffer);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1);
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(" ");
  }
  feedgps();
}



static bool feedgps()
{
  while (Serial.available())
  {
    if (gps.encode(Serial.read()))
      return true;
  }
  return false;
}

void kirim_sms() {//program untuk mengirim pesan singkat
  mySerial.println("AT + CMGS = \"+6289637726652\"");
  delay(100);
  mySerial.println ('malinggggg');
  delay(100);
  mySerial.println((char)26);
  delay(100);
  mySerial.println();
  ind_kirim_sms = ind_kirim_sms - 1;
}

void ProcessGprsMsg() {
  if( msg.indexOf( "Call Ready" ) >= 0 ){
   //  Serial.println( "*** GPRS Shield registered on Mobile Network ***" );
     mySerial.println( "AT+CMGF=1" );
  }
  
  // EN: unsolicited message received when getting a SMS message
  if( msg.indexOf( "+CMTI" ) >= 0 ){
 
     int iPos = msg.indexOf( "," );
     String SmsStorePos = msg.substring( iPos+1 );
     Serial.print( "AT+CMGR=" );
     Serial.println( SmsStorePos );
  }
  
  // EN: SMS store readed through UART (result of GprsReadSmsStore request)  
  if( msg.indexOf( "+CMGR:" ) >= 0 ){
    // EN: Next message will contains the BODY of SMS
    SmsContentFlag = 1;
    // EN: Following lines are essentiel to not clear the flag!
    msg = "";
    return;
  }
  
  // EN: +CMGR message just before indicate that the following GRPS Shield message 
  //     (this message) will contains the SMS body 
  if( SmsContentFlag == 1 ){
 //   Serial.println( "*** SMS MESSAGE CONTENT ***" );
 //   Serial.println( msg );
 //   Serial.println( "*** END OF SMS MESSAGE ***" );
    ProcessSms( msg );
  }
  
  msg = "";
  // EN: Always clear the flag
  SmsContentFlag = 0; 
}

void ProcessSms( String sms ){
  
  if( sms.indexOf("ona") >= 0 ){
    digitalWrite( relay_a, HIGH );
    ind_kirim_sms = 2;
  }
   if( sms.indexOf("onb") >= 0 ){
    digitalWrite(  relay_a, LOW );
  }
   
}

how it was in the serial pin sim900 rx tx 0 1
and gps are in serial1 tx rx pin 19 18

_10_01_2014.ino (8.7 KB)

What obstacle?

Have you managed to get the shields working on their own?

#define Rx 14
#define Tx 15
SoftwareSerial mySerial(Rx,Tx);//komunikasi serial untuk modul GSM

You can NOT do software serial on the hardware serial pins. They are all in use already.

is there a solution that is right for my program ..

I hope I can run programs

paul do you have a program.?