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 > Tutorials
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Tutorials Basic4ppc tutorials

GPS application - Part I

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 07-13-2010, 10:13 AM
Knows the basics
 
Join Date: Jul 2010
Location: St.Petersburg
Posts: 59
Default

Hello. I'm a complete noob in the serial and GPS stuff can you please help me getting started?
I run the ComPorts.sbp on my device and this is what I get:
COM3::
COM5:: Serial Cable on COM5:
COM7::
COM8::
COM9::

So in the GPS example I set
Port = 5
in Sub Globals

When I run the app and click mnuConnect:Label1.Text = "Error opening port 5"

What's wrong?? Please help me.
Getting knowlege on these issues is very important to me.

Reply With Quote
  #12 (permalink)  
Old 07-13-2010, 10:22 AM
Knows the basics
 
Join Date: Jul 2010
Location: St.Petersburg
Posts: 59
Default

Ooops I tried Port = 3
On clicking mnuConnect : Label1.Text = "Serial port is open"
and in 5 seconds - "No connection" and a msgbox :
"GPS was disconnected.Do you want to reconnect?"

Any help will be much appreciated
Thank you.
Reply With Quote
  #13 (permalink)  
Old 07-13-2010, 03:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Did you connect a GPS to this port?
__________________
Basic4android documentation
Reply With Quote
  #14 (permalink)  
Old 07-13-2010, 03:43 PM
Knows the basics
 
Join Date: Jul 2010
Location: St.Petersburg
Posts: 59
Default

I just copied the source code.
How am I to connect a GPS to the port?
I have never even used a GPS so please pardon me asking silly questions
Reply With Quote
  #15 (permalink)  
Old 07-14-2010, 07:29 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Does your device have an internal or external GPS? If it has an internal GPS you could search google to find the port number based on the device model.
__________________
Basic4android documentation
Reply With Quote
  #16 (permalink)  
Old 07-15-2010, 10:47 AM
Knows the basics
 
Join Date: Jul 2010
Location: St.Petersburg
Posts: 59
Default

My device has external GPS . I have to choose a programm port COM0 to
COM9, GPD1 to GPD9; and a hardware port COM0 to COM9

Running the ComPorts.sbp gives the following result:
COM3::
COM5:: Serial Cable on COM5:
COM7::
COM8::
COM9::



Running GPS4PPC (older version) I get msgbox "Error opening port:5"
If select COM3 I get msgbox "GPS is connected" and in 3 seconds "GPS disconnected"


Edit:

I have querried my device's support service and was told that my RoverPC c6 has no GPS module.

That is wierd as I have on the menu Settings => System => External GPS

Last edited by Monsterman22 : 07-15-2010 at 12:46 PM. Reason: additional info
Reply With Quote
  #17 (permalink)  
Old 07-21-2010, 10:53 AM
Newbie
 
Join Date: Jul 2010
Posts: 1
Default Error compiling program

hey guys,

when i try to compile the file to a Smartphone.exe the Basic4ppc-Desktop-compiler give me the error:"Smartphones do not support listbox control".

what's the issue? must i replace the listbox for something else?


dK
Reply With Quote
  #18 (permalink)  
Old 07-21-2010, 01:19 PM
Basic4ppc Veteran
 
Join Date: May 2008
Location: Newcastle Upon Tyne - England
Posts: 269
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You appear as an un-registered user. How are you compiling?

Also, because Smartphones do not have touch-screens, some controls that require stylus input can not be used and you get the error above.

Last edited by Zenerdiode : 07-21-2010 at 01:24 PM.
Reply With Quote
  #19 (permalink)  
Old 08-11-2010, 11:08 AM
Junior Member
 
Join Date: Nov 2009
Posts: 37
Default GPS Speed without moving

I'm trying GPSDriver and GPS dll's and I notice that both lat/lon and speed are "moving" without moving, e.g. the speed fluctuates (2km/h, 4km/h...), so it's impossible to make a reliable distance calculation using this sample code:

Code:
Sub getDistanceKM(lat1, long1, lat2, long2)

    DEGREES_TO_RADIANS = (
cPI / 180.0)
    EARTH_RADIUS = 
6371.0
    
    rlat1 = DEGREES_TO_RADIANS * lat1
    rlong1 = DEGREES_TO_RADIANS * long1
    rlat2 = DEGREES_TO_RADIANS * lat2
    rlong2 = DEGREES_TO_RADIANS * long2
    
    
'    There is no real reason To break this lot into 
    '    4 statements but I just feel it's a little more 
    '    readable.
    p1 = Cos(rlat1) * Cos(rlong1) * Cos(rlat2) * Cos(rlong2)
    p2 = 
Cos(rlat1) * Sin(rlong1) * Cos(rlat2) * Sin(rlong2)
    p3 = 
Sin(rlat1) * Sin(rlat2)

    ret = p1 + p2 + p3
    
If ret = 1 Then Return 0
    
    ret = 
ACos(ret)
    ret = ret * EARTH_RADIUS
    
    
Return ret
    
End Sub
Reply With Quote
  #20 (permalink)  
Old 08-11-2010, 11:38 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Berkshire, UK
Posts: 762
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by diego View Post
I notice that both lat/lon and speed are "moving" without moving, e.g. the speed fluctuates (2km/h, 4km/h...), so it's impossible to make a reliable distance calculation ...
That's probably the inherent inaccuracy of a simple GPS receiver. Which is why, in http://www.basic4ppc.com/forum/open-...html#post36567 I included an averaging function.

Unfortunately I made the mistake of averaging the direction of travel too. When that alternates between 359 and 001 degrees the average comes out at 180, which is south rather than north! I haven't got a solution for that yet... (Klaus?)

Mike.
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
My first application Erel Tutorials 16 04-18-2010 09:09 PM
GPS application - Part II Erel Tutorials 8 03-19-2009 09:09 AM
Application Name kawawong Questions (Windows Mobile) 1 02-12-2008 10:38 AM
Getting value from other other application in runtime Rioven Questions (Windows Mobile) 19 09-20-2007 10:13 AM
DB Application scott93727 Share Your Creations 0 05-02-2007 06:24 AM


All times are GMT. The time now is 02:13 AM.


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