
Originally Posted by
FromTheCockpit
I got the co-ordinates working now. Just wondering how to go about getting the speed into variable as it keeps changing, 1.14 knots now, may be 100.20 knots later!
That's great!
To convert knots to Km/h:
Code:
knots var word 'xx.x knots is going to have to become xxx knots for this math
kmph var word
temp var word
temp = knots * 1852 'first part of div32 function
kmph = div32 1000 'this result should be printed out with one decimal
'in other words result xxx should be printed as xx.x km/h
so for above example, if you had 30.0 knots as speed then
knots = 300
temp = knots * 1852 = 555600
(you may notice this is bigger than 16 bits, but that's ok. The div32 lets us have up to a 31 bit number, so not to worry).
555600/1000 = 555
So, the answer must be printed out in decimal as 55.5 km/h
which is the pbp way to do knots * 1.852 = km/h
Last edited by ScaleRobotics; - 2nd November 2009 at 03:34.
http://www.scalerobotics.com
Bookmarks