Hello,
i'd like to check the distance with GPS Modul. I use some functions from GPS4PPC.sbp and modified it. P.E.
Sub Timer1_Tick
stat = GPS1.Status
If Serial1.InBufferCount > 0 Then
Label2.Text = "GPS is connected."
GPS1.GPSStream(Serial1.InputString)
north = GPS1.LatitudeHemisphere
If checkdis < 1 Then
If north = "n" Then
n = true
Else
n = false
End If
n = true
n = true
vlat = GPS1.Latitude
vlot = GPS1.Longitude
End If
checkdis = checkdis +1
If checkdis = 5 Then
distanz
checkdis = 0
End If
counter = 0
Else
counter = counter + 1
If counter >= 5 Then 'After 5 seconds without any data we will try to make a new connection.
counter = 0
Timer1.Enabled = false
Serial1.PortOpen = false
Label2.Text = "No connection."
GPS1.GPSBuffer = ""
If Msgbox("GPS was disconnected." & crlf & "Do you want to reconnect?","",cMsgboxYesNo) = cYes Then
mnuConnect_Click 'Try to reconnect.
End If
End If
End If
End Sub
Sub distanz
If Gps1.SpeedOverGround * umrech >5 Then
n = true
LL() = Converter.UTMToLatLon(6378137,1/298.257223563,33,vlat,n,vlot)
lat1 = LL.Lat
lon1 = LL.Lon
LL() = Converter.UTMToLatLon(6378137,1/298.257223563,33,GPS1.Latitude,n,GPS1.Longitude)
Distance_Course(lat1,lon1,LL.Lat,LL.Lon)
dis() = res()
di = (dis.Distance * 1.852 + da)
dia= Round(di ,2)
label5.Text = dia
da = dia
End If
End Sub
But i get creazy results. If i multiplicate di with 1000 then the distance is around the true distance but only around. What' wrong?
Georg
i'd like to check the distance with GPS Modul. I use some functions from GPS4PPC.sbp and modified it. P.E.
Sub Timer1_Tick
stat = GPS1.Status
If Serial1.InBufferCount > 0 Then
Label2.Text = "GPS is connected."
GPS1.GPSStream(Serial1.InputString)
north = GPS1.LatitudeHemisphere
If checkdis < 1 Then
If north = "n" Then
n = true
Else
n = false
End If
n = true
n = true
vlat = GPS1.Latitude
vlot = GPS1.Longitude
End If
checkdis = checkdis +1
If checkdis = 5 Then
distanz
checkdis = 0
End If
counter = 0
Else
counter = counter + 1
If counter >= 5 Then 'After 5 seconds without any data we will try to make a new connection.
counter = 0
Timer1.Enabled = false
Serial1.PortOpen = false
Label2.Text = "No connection."
GPS1.GPSBuffer = ""
If Msgbox("GPS was disconnected." & crlf & "Do you want to reconnect?","",cMsgboxYesNo) = cYes Then
mnuConnect_Click 'Try to reconnect.
End If
End If
End If
End Sub
Sub distanz
If Gps1.SpeedOverGround * umrech >5 Then
n = true
LL() = Converter.UTMToLatLon(6378137,1/298.257223563,33,vlat,n,vlot)
lat1 = LL.Lat
lon1 = LL.Lon
LL() = Converter.UTMToLatLon(6378137,1/298.257223563,33,GPS1.Latitude,n,GPS1.Longitude)
Distance_Course(lat1,lon1,LL.Lat,LL.Lon)
dis() = res()
di = (dis.Distance * 1.852 + da)
dia= Round(di ,2)
label5.Text = dia
da = dia
End If
End Sub
But i get creazy results. If i multiplicate di with 1000 then the distance is around the true distance but only around. What' wrong?
Georg