Is there anyone who can help me with a code from which I can navigate between two point gps using an hmc compass, GPS shield and arduino uno
A good GPS library will have a "bearingTo" method (name may differ).
i need to calculate the distance between two gps coordinate
i have test this programme but it's dose'ent march
float calc_distance(float flat1, float flon1, float flat2, float flon2)
{
float diflon;
float dist;
float a;
float b;
int R = 6371000;
flat1 = radians(flat1);
flat2 = radians(flat2);
diflon = radians((flon2)-(flon1));
a = sin(flat1)*sin(flat2);
b = cos(flat1)*cos(flat2)*cos(diflon);
dist = acos(a+b)*R;
return dist;
}
If you post the complete program and details of exactly what components you're using someone may be able to help.
The only thing I can immediately see in the fragment you've posted is that the value you use for R is way too big for an int. I don't know if that has anything to do with whatever the problem is that you're seeing.
Steve