user42279: I am trying to create a project which involves getting latitude and longitude via GPS Module and send it via GSM Module. My problem here is that individual code is working perfectly. However, if am to initialize both together, none will work.
#include "GSM.h"//wrapper class for Sim800l library
#include "GPS.h"//wrapper class for TinyGPS library
GSM *gsm;
GPS *gps;
void setup()
{
    Serial.begin(9600); // Debugging only
    gsm = new GSM();//initializes SIM800l 
    //gps = new GPS(11,10 );//initializes NEO6MV2//uncommmenting this line won't make both modules work
}
String telNum;
int i = 1;
void loop()
{
    /*
    Serial.println(gps->getLongitude(),6);
    Serial.println(gps->getLatitude(),6);
    */

    Serial.println(gsm->read(i,telNum));
    Serial.println(telNum);
     ++i;
}



user42279: I got it working by initializing and  deleting the pointer to the GPS and GSM object. 
Initialization and freeing of the objects are made in the loop function. I initialize the GPS, run it in a loop for sometime, destroy it and initialize the GSM and same procedure as GPS.
Though I don't know if it'll have any effects but its working perfectly
#include "GSM.h"
#include "GPS.h"
GSM *gsm;
GPS *gps;
void setup()
{
    Serial.begin(9600); // Debugging only
}

unsigned long previousMillis = 0;//could be any value depending on how quick you want it to elapse
const long interval = 100; //could be any value depending on how long you want it to run
void loop()
{
    gps = new GPS(6, 7);//initialization <SoftwareSerial::begin() function called here>
    while (previousMillis <= interval) 
    {       
        //GPS codes here
        ++previousMillis;
    }
    delete gps;         //destory initialized object
    previousMillis = 0; //reset value

    gsm = new GSM();    //initialization <SoftwareSerial::begin() function called here>
    while (previousMillis <= interval)
    {

        //GSM codes here
        ++previousMillis;
    }
    delete gsm;//destory initialized object

    previousMillis = 00;//reset value
}


42279: <p>I am trying to create a project which involves getting latitude and longitude via GPS Module and send it via GSM Module. My problem here is that individual code is working perfectly. However, if am to initialize both together, none will work.</p>

<pre><code>#include "GSM.h"//wrapper class for Sim800l library
#include "GPS.h"//wrapper class for TinyGPS library
GSM *gsm;
GPS *gps;
void setup()
{
    Serial.begin(9600); // Debugging only
    gsm = new GSM();//initializes SIM800l 
    //gps = new GPS(11,10 );//initializes NEO6MV2//uncommmenting this line won't make both modules work
}
String telNum;
int i = 1;
void loop()
{
    /*
    Serial.println(gps-&gt;getLongitude(),6);
    Serial.println(gps-&gt;getLatitude(),6);
    */

    Serial.println(gsm-&gt;read(i,telNum));
    Serial.println(telNum);
     ++i;
}
</code></pre>

<p><a href="https://i.stack.imgur.com/Kbju2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kbju2.png" alt="enter image description here"></a></p>
 42279: <p>I got it working by initializing and  deleting the pointer to the GPS and GSM object. </p>

<p>Initialization and freeing of the objects are made in the loop function. I initialize the GPS, run it in a loop for sometime, destroy it and initialize the GSM and same procedure as GPS.</p>

<p>Though I don't know if it'll have any effects but its working perfectly</p>

<pre><code>#include "GSM.h"
#include "GPS.h"
GSM *gsm;
GPS *gps;
void setup()
{
    Serial.begin(9600); // Debugging only
}

unsigned long previousMillis = 0;//could be any value depending on how quick you want it to elapse
const long interval = 100; //could be any value depending on how long you want it to run
void loop()
{
    gps = new GPS(6, 7);//initialization &lt;SoftwareSerial::begin() function called here&gt;
    while (previousMillis &lt;= interval) 
    {       
        //GPS codes here
        ++previousMillis;
    }
    delete gps;         //destory initialized object
    previousMillis = 0; //reset value

    gsm = new GSM();    //initialization &lt;SoftwareSerial::begin() function called here&gt;
    while (previousMillis &lt;= interval)
    {

        //GSM codes here
        ++previousMillis;
    }
    delete gsm;//destory initialized object

    previousMillis = 00;//reset value
}
</code></pre>
