How to send gps location using gsm module depending on the area

Good day! i have facing problem on sending sms message depending on the area. For example i'm using MPU6050 Accelometer. when this sensor triggred the sms message will send depends on the are like if its triggred on location 1 the gsm module will send sms message only in the first number +639xxxxxxxxx but if the sensor triggred in another location like location 2 it will only send on the number 2 +639xxxxxxxx im using
sim800c gsm module
neo6mv2 gps module
arduino uno
mpu6050 accelometer
also i used tinygps.h library thank you

Well you get the location of the module at the time of whatever you call triggering and compare the distance with the known locations to know where to send the sms

The library you are using has a nice function for you float distance_between (float lat1, float long1, float lat2, float long2);

please read how to use the forum to post code... and I'm not too sure what to look for into what you posted..

I did notice in the global declarations the

const long TargetLat1 = constrain(TargetLat1, 14.7028300, 14.7028460);
const long TargetLon1 = constrain(TargetLon1, 121.0403210, 121.0403410);
const long TargetLat2 = constrain(TargetLat2, 14.6997000, 14.7081930);
const long TargetLon2 = constrain(TargetLon2, 121.0309340, 121.0389680);

which seems very weird...

I dont know what to do any reference code pls thank you so much

how to get the valid location from the gps to set my specific location and send it on specific receipient

Fix your post with code - Read forum rules - I won’t answer anymore until it’s done

I gave you the high level algorithm why don’t you try a small code that looks up current position and see if it’s close or not to a known location ? Would be a good start to explore -
Don’t try to boil the ocean at first, put aside your accelerometer and sms for the time being

Good day everyone! what code should i used for sending sms message depends on the area. the things that i used in my protoype i have MPU6050 accelometer, SIM800C GSM MODULE, NEO6MV2 GPS MODULE. So the flow is if the Accelometer triggred the GSM module will get the GPS location only if the area is on the target location 1 so it will only send to the recepient 1. But if its triggred in another location, Targetlocation2 it will only send on receipient 2.
My question is how to used the longitude and latitude data to get the exact data of what my gps module gets? so that i can use that data to send sms message on specific place or area thank a lot
also i used TINYGPS.H LIBRARY thank you!

More here

You can get latitude and longitude from the GPS and as long as the target areas are rectangular use them to determine whether or not the GPS is in one of the target areas and if so, send the appropriate message to the appropriate recipient

Is that what you want to do ?

Duplicate topics merged

@REINIEL027 - why did you start a second topic for the same subject, particularly when you had received help on the first one ?

UKHeliBob:
You can get latitude and longitude from the GPS and as long as the target areas are rectangular use them to determine whether or not the GPS is in one of the target areas and if so, send the appropriate message to the appropriate recipient

Is that what you want to do ?

Yes

Then where are you stuck ?

You can get lat/long from the GPS
You know the lat/long coordinates of the target area corners. If not, then you need to

create an array of structs holding target lat, long, phone number, message to be sent and a hit flag

read the GPS

use a for loop to read target lat from the array of structs
if the lat is within the limits of the target then test the long for the target
if the long is within the target, mark the hit in the struct for the current target

when all targets have been tested, iterate through the array to find any that are marked as hits
get the 'phone number and message from the struct, use it and remove the hit mark ready for next time

If arrays and structs are not something that you know about the Mr. Google is your friend