Parallel Monitoring - GPS, GSM

Hi,

I need to have a program wherein I have two continuous monitoring processes:
1 - to Identify physical location (GPS) and
2 - to Check for an incoming phone call. The call triggers main function

Right now, I have written two separate programs. In each of these programs, inside the loop(), I call the function for respective purpose - identify location/ monitor phone call.

Request guidance on how can I merge the two (effectively, monitoring 2 processes inside loop..).

P.S.: a light-weight option will have to be taken as my program on ATMEGA328P has consumed 77% of flash and, 82% of dynamic memory.

Regards

Request to Administrators-

Wrongly posted this post under Project Guidance. Pls. move this post to Programming Questions

But it’s not really a programming question, is it?
A programming question would have code, wouldn’t it?

Fine AWOL,

Pls. let my post stay here.

Regarding my problem, I am trying to figure out a way to incorporate two sketches, running continuously, into a single program.

code template:

Setup() {
	setupGPS(); 
	setupGSM(); //
}

loop() {
	//continuously track location
	while (true)
		readGPS();
	
	//keep monitoring for any incoming call
	while (true)
		monitorGSM();
}

readGPS() {
	//fetch coordinates
}

monitorGSM() {
	//respond if there is an incoming call
}

Excuse me, if it is elementary but I was unable to think it myself. In the sketch template above, if the flow enter in to either one of the functions contained within loop(), it does come out to next function. Both readGPS() and monitorGSM() have to run continuously.

Request some guidance on the approach that'll solve the puzzle for me.

Regards

Since loop is called repeatedly, this should do it:

loop() {
	//continuously track location
		readGPS();
	
	//keep monitoring for any incoming call
		monitorGSM();
}

Reading the serial port for the GPS should leave plenty of time to work with the GSM. Just ensure that neither routine has any delays in it.