Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

Measuring distance on move

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-22-2007, 10:53 PM
Junior Member
 
Join Date: May 2007
Posts: 35
Default Measuring distance on move

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.
Attached Files
File Type: zip Distmeter.zip (1.3 KB, 171 views)

Last edited by Agrartec : 06-24-2007 at 07:29 PM.
Reply With Quote
  #2 (permalink)  
Old 06-28-2007, 01:58 PM
Junior Member
 
Join Date: May 2007
Location: Germany
Posts: 45
Default 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.

Code:
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
Attached Files
File Type: zip Distmeter2.zip (1.6 KB, 161 views)
Reply With Quote
  #3 (permalink)  
Old 06-28-2007, 02:17 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Nice tip
Reply With Quote
  #4 (permalink)  
Old 06-28-2007, 10:43 PM
Junior Member
 
Join Date: May 2007
Posts: 35
Default

Thanks a lot, works better than my version.


A little hint so that it really works: it is "cgray" and not "cgrey".
Reply With Quote
  #5 (permalink)  
Old 06-28-2007, 11:10 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,313
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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!!!
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France-Saumur
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
B4PPC DLL Version Listing - B4Android DLL Version Listing
Reply With Quote
  #6 (permalink)  
Old 06-29-2007, 10:57 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 614
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Basic4PPC is a "English correct" enviroment!!!
Not strictly true... colour is still spelt Color

Regards
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #7 (permalink)  
Old 06-29-2007, 11:27 AM
JJM JJM is offline
Senior Member
 
Join Date: Apr 2007
Location: France
Posts: 123
Default

Hello,

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

JJ M
Reply With Quote
  #8 (permalink)  
Old 06-29-2007, 05:56 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,313
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France-Saumur
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
B4PPC DLL Version Listing - B4Android DLL Version Listing
Reply With Quote
  #9 (permalink)  
Old 06-29-2007, 06:13 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 614
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You started it!


Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #10 (permalink)  
Old 07-01-2007, 02:07 PM
Junior Member
 
Join Date: May 2007
Posts: 35
Default

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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating distance abastien Code Samples & Tips 8 01-10-2009 09:49 AM
move to the last row at a table Georg Questions (Windows Mobile) 2 05-20-2008 09:43 PM
GPS Distance Problem Georg Questions (Windows Mobile) 6 04-25-2008 05:10 AM
Distance-test on UTM and LAT-LON Put Claude Questions (Windows Mobile) 1 10-16-2007 02:06 PM
Distance Calculator PatrikL Share Your Creations 7 04-30-2007 06:15 PM


All times are GMT. The time now is 01:33 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0