Measuring distance on move

Agrartec

Member
Licensed User
I have made a small application to measure the distance on moving. By now I`ve only tested it at 6 to 10 km/h. And so far it worked not bad, but there are still some bugs that I didn`t get rid of yet.
I think one problem is that the timers should work syncronised, but I don`t know how to manage that.

Or maybe I did a big mistake and don`t see/know it. I am not so sure if the calculation with those utm-data is correct. The tests weren`t much precise so far.

If some of you can need this then you are welcome to help me a little bit.
At first you need to add the .dll for serial and GPS of course and you must replace the port and baud-rate to those your GPS-reciever uses.

edit: I forgot to say that its only possible to start measuring when standing still (speed < 1). This can be changed in the code.
 

Attachments

Last edited:

BerndB

Member
Licensed User
GPS Distance Meter

Hi agrartec,

this is a version without the 2. timer.

For good precission you should not calculate with rounded UTM-Data.
(If you watch the data, you see that most differences happen behind the comma)

In this version I introduced an additional button to switch the GPS-device.
Then it's possible to restart the GPS connection, after a power off and power on of you PDA, automatically.

B4X:
Sub Timer1_Tick
  if serial.InBufferCount>0 then 
    GPS.GPSStream(gps.GPSStream(Serial.InputString)) 'Takes the data received from the GPS to GPSStream.
  else      
    ' reactivate GPS after a power off/on automatically when GPS was active before
    sleep(2000)
    if serial.InBufferCount<=0 then      
      if BtGPS.color=cGreen then
        serial.EnableOnComm =false
        Serial.PortOpen = false 'Closes the seria
        TBsats.text=""
        serial.EnableOnComm =true
        Serial.PortOpen = true 
      end if    
    end if
  end if
End Sub
Ciao
BerndB
 

Attachments

Agrartec

Member
Licensed User
Thanks a lot, works better than my version. :)


A little hint so that it really works: it is "cgray" and not "cgrey".
 

Cableguy

Expert
Licensed User
A note about cGray!!
VB supports both cGrey and cGray althought the correct English form is Grey....So sometimes developers wich code in bth platforms get mixed up...
Basic4PPC is a "English correct" enviroment!!!
 

RandomCoder

Well-Known Member
Licensed User
Basic4PPC is a "English correct" enviroment!!!
Not strictly true... colour is still spelt Color ;)

Regards
RandomCoder
 

JJM

Active Member
Licensed User
Hello,

On Harrap's dictonnary
gray is an americain word
grey is a britanic word !!!...
bye

JJ M
 

Cableguy

Expert
Licensed User
I think that Colour is not a English word but more of an Americanized form of the word...

A derivated word like colored is not written "coloured"....

Anyway this is:sign0006:
 

RandomCoder

Well-Known Member
Licensed User
You started it!
;)

Regards,
RandomCoder
 

Agrartec

Member
Licensed User
Ok, it seems that there are small differences in English and American spelling. But I had the problem that only "cgray" was accepted by B4ppc. When I use the code as BerndB wrote it, then I get error "cgrey is not a variable" or so.

Does the code work at other people here with "cgrey"?

Greets John.
 

RandomCoder

Well-Known Member
Licensed User
No, only cGray will work with B4PPC.

Regards,
RandomCoder
 

JJM

Active Member
Licensed User
Hi John,


You have only to change gGrey by cGray and after all is OK.
If you want you can change cGrey by cRed or cBlue ...

Bye
JJ M
 

Agrartec

Member
Licensed User
Thanks for your help, but this problem I could solve by myself. It just wondered me that BerndB wrote "cgrey" in the code and Cableguy said "VB supports both spellings". So I was confused about the error.

@BerndB: Didn`t you test your version? ;)
 

BerndB

Member
Licensed User
Hi agratec,

I was busy last time, so I didn't join the forum...

I use Version 5, and usually only work on PPC.
I did test the code, but it was only compiled on the PPC. Your errormessage you got on the PC?
As far as I remember the compiler ignored 'cgrey' - I didn't receive an error message - but the color was an other kind of gray than cGray.

I didn't notice it that time, and in principle the code worked - so I didn't worry about cGrey and cGray ....

Sorry for the confusion I produced :signOops:

regards BerndB
 

jerryjukem

Member
Licensed User
Utm Number

I tried your program but have a problem on the xutm. This constantly gives me the wrong number on the utm(1) from decimal lat.My lat is about 36 but get a number like 64568. Have you checked this? I am using a hp6515. Is it possible the gps data string is wrong? The y coordinate seems to be ok. Also, what is condition "A"?

Thanks
 
Top