![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
|
|||
|
It does not work to calculate the distanc with Lat/Lon during the drive, to much diverence. I made it on this way and it works fine
Sub distanz If Gps1.SpeedOverGround * umrech >= 4 Then sek = sek +1 da =da + (Gps1.SpeedOverGround * umrech/3600) di = Round(da,2) If di > 0 Then label8.Text = Round(da*3600/sek,2) & " Km/h" End If label9.Text = di & " Km" If sek/3600 > 1 Then h = Round(sek/3600,0) m = (sek -(h*3600))/60 Else h = 0 m = Round(sek/60,0) End If label14.Text = h & " h " & m & " min" End If End Sub called by Timer umrech value of miles or Km perhaps it helps some other one Georg |
|
|||
|
Hi Georg,
do I really understand you, that you want to measure the distance while moving? I did this using UTM-data. Here Measuring distance on move is the thread to the code sample. John |
|
|||
|
Hi John,
thank you. That is exactly what i searching for. It works very well. You are right with GPS.SpeedOverGround > 2. But sometimes the Speed on my Devise runs up to 6 and 7 Km/h without moving. Perhaps the problem is, that in germany all the things are more nervous. Georg |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calculating distance | abastien | Code Samples & Tips | 4 | 05-15-2008 07:11 PM |
| Distance-test on UTM and LAT-LON | Put Claude | Questions & Help Needed | 1 | 10-16-2007 02:06 PM |
| Distance between UTM zones | jerryjukem | Questions & Help Needed | 3 | 10-10-2007 11:19 AM |
| Measuring distance on move | Agrartec | Code Samples & Tips | 15 | 08-28-2007 02:43 AM |
| Distance Calculator | PatrikL | Share Your Creations | 7 | 04-30-2007 06:15 PM |