sending GPS data through GPRS using arduino

iam building arduino tracking system using sim900 GPRS and sparkfun em406 GPS i wrote this code but it only generate the GPS output but it don’t send it to my tracking site and the http request don’t generate any output what can i change?

#include <SoftwareSerial.h>
#include "Arduino.h"
#include <TinyGPS.h>

#define RXPIN 9
#define TXPIN 10

#define TERMBAUD  19200

// Set this value equal to the baud rate of your GPS
#define GPSBAUD  4800

// Create an instance of the TinyGPS object
TinyGPS gps;
// Initialize the SoftwareSerial library to the pins you defined above
SoftwareSerial uart_gps(RXPIN, TXPIN);
SoftwareSerial mySerial(7, 8);
// This is where you declare prototypes for the functions that will be 
    // using the TinyGPS library.
void getgps(TinyGPS &gps,float &lan, float &lon);
int num=2;
// In the setup function, you need to initialize two serial ports; the 
// standard hardware serial port (Serial()) to communicate with your 
// terminal program an another serial port (SoftwareSerial()) for your 
// GPS.
void setup()

  // Sets baud rate of your terminal program
  // Sets baud rate of your GPS

  Serial.println("GPS Shield QuickStart Example Sketch v12");
  Serial.println("       ...waiting for lock...           ");

// This is the main loop of the code. All it does is check for data on 
// the RX pin of the ardiuno, makes sure the data is valid NMEA sentences, 
// then jumps to the getgps() function.
void loop()
  float lat,lon;
  while(uart_gps.available()&&num==2)     // While there is data on the RX pin...
      int c =;    // load the data into a variable...
      if(gps.encode(c))      // if there is a new valid sentence...
        getgps(gps,lat,lon);         // then grab the data.

  // The getgps function will get and print the values we want.
  void getgps(TinyGPS &gps,float &lat2,float &lon2)
    // To get all of the data into varialbes that you can use in your code, 
    // all you need to do is define variables and query the object for the 
    // data. To see the complete list of functions see keywords.txt file in 
    // the TinyGPS and SoftwareSerial libs.

    // Define the variables that will be used
    float latitude, longitude;
    // Then call this function
    gps.f_get_position(&latitude, &longitude);
    // You can now print variables latitude and longitude
    Serial.print("Lat/Long: "); 
    Serial.print(", "); 

    Serial.print("Altitude (meters): "); Serial.println(gps.f_altitude());  
    // Same goes for course
    Serial.print("Course (degrees): "); Serial.println(gps.f_course()); 
    // And same goes for speed
    Serial.print("Speed(kmph): "); Serial.println(gps.f_speed_kmph());

    // Here you can print statistics on the sentences.
    unsigned long chars;
    unsigned short sentences, failed_checksum;
    gps.stats(&chars, &sentences, &failed_checksum);
    //Serial.print("Failed Checksums: ");Serial.print(failed_checksum);
    //Serial.println(); Serial.println();

    // Here you can print the number of satellites in view
    Serial.print("Satellites: ");
  void SubmitHttpRequest(long lat, long lng)

    ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too.



    mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs


    mySerial.println("AT+SAPBR=3,1,\"\",\"CMNET\"");//setting the APN, the second need you fill in your local apn server


    mySerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual


    mySerial.println("AT+HTTPINIT"); //init the HTTP request


    mySerial.print("AT+HTTPPARA=\"URL\",\"");// setting the httppara, the second parameter is the website you want to access


    mySerial.println("AT+HTTPACTION=0");//submit the request 
    delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.


    mySerial.println("AT+HTTPREAD");// read the data from the website you access



   void ShowSerialData()


Use code tags. Thanks.

any help please :roll_eyes: :cold_sweat: :(

Which Arduino are you using? You can't listen to two software serial ports at the same time. So, you can listen to the GPS or you can listed to/talk to the GPRS device. GPS data that arrives while you are talking to/listening to the GPRS device will be lost.

You have a lot of string literals occupying SRAM that don't need to.

We can't see your serial output, so we can't begin to guess what you are doing wrong.

Do you know that you can do anything with the GPRS?

iam using arduino uno, and i tried to make an integer that switch between the GPS and gprs by

while(uart_gps.available()&&num==2)     // While there is data on the RX pin...
        int c =;    // load the data into a variable...
        if(gps.encode(c))      // if there is a new valid sentence...
            getgps(gps,lat,lon);         // then grab the data.
SubmitHttpRequest(lat, lng);

but also it didn't work

And what adjustments i need to do to solve this problem

mohd9011: And what adjustments i need to do to solve this problem

Presumably you are not using the hardware serial port for either device because you want to keep it for debugging. So, start debugging.

Iam using there ports the GPS uses 2,3 but when it's connected to the GPRS i disconnect these pins and connect them through 9,10 through wires, and the GPRS connected through 7,8 pins as the data sheet.