AlainB Posted September 16, 2012 Author Share Posted September 16, 2012 (edited) As I said before, my app mimic the GOTO function that you will have in almost if not all the handheld GPS. It is very usefull in many differents situations. It has nothing to do with turn by turn navigation. There are many apps available for Android that do the same thing and they are doing it much more nicely than mine I am sure. But these apps, like my handheld GPS are loaded with lots of almost useless screen that, I for one, never use. You should see the number of time I have to press buttons before finally being ready to go to the destination with any of my handheld GPS. On my app, you will click on the Destination Label (The second label) and will appear the list of the already saved POI (points of interest). Chose one and you will be ready to go. The only other thing that you will be able to do is to save the actual location as a new POI. That's all. These 2 functions are not made yet. Mainly, what I would be extremely interested in is comments on the code that I post here. How maybe it could be improved, be made more efficient. Edited September 16, 2012 by AlainB Link to comment Share on other sites More sharing options...
Cyber Posted January 11, 2015 Share Posted January 11, 2015 Maybe this could help: #include <WinAPI.au3> $RESULT = _WinAPI_CreateFile(".COM3", 2, 2) If $RESULT = 0 then msgbox(16, "", "Port not available, please plug in your device") else $tBuffer = DllStructCreate("byte[6]") _WinAPI_ReadFile($RESULT, DllStructGetPtr($tBuffer), 6, $nBytes) _WinAPI_CloseHandle($RESULT) $sText = BinaryToString(DllStructGetData($tBuffer, 1)) msgbox(64, "Reading", "This is the output of 6 bytes from COM3: " & $sText) EndIf Fantastic! this code is good for read but for write? thanks Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key Link to comment Share on other sites More sharing options...
Developers Jos Posted January 11, 2015 Developers Share Posted January 11, 2015 Write to what ? The gps module likely will be read only. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Cyber Posted January 11, 2015 Share Posted January 11, 2015 (edited) Write to what ? The gps module likely will be read only. Jos Yes, sorry I use it for read of relay state Can i send write on digital input? General input Not for gps Edited January 11, 2015 by Cyber Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key Link to comment Share on other sites More sharing options...
Developers Jos Posted January 11, 2015 Developers Share Posted January 11, 2015 Can i send write on digital input? General input Sorry, but this still doesn't make much sense to me:"Write to digital input?" Try to be a little bit more explicit what you exactly want to accomplish. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Cyber Posted January 11, 2015 Share Posted January 11, 2015 (edited) Sorry, but this still doesn't make much sense to me:"Write to digital input?" Try to be a little bit more explicit what you exactly want to accomplish. Jos ok il try i use this code for read input from pin 3 of my arduino: #include <WinAPI.au3> $RESULT = _WinAPI_CreateFile("\\.\COM3", 2, 2) $nBytes=1 $nBytesw=0 $pin = 3 If $RESULT = 0 then msgbox(16, "", "Port not available, please plug in your device") else $tBuffer = DllStructCreate("byte[6]") _WinAPI_ReadFile($RESULT, DllStructGetPtr($tBuffer),$pin , $nBytes) _WinAPI_CloseHandle($RESULT) $sText = BinaryToString(DllStructGetData($tBuffer, 1)) msgbox(64, "Reading", "This is the output of 6 bytes from COM3: " & $sText) EndIf I take the code from this post.... and now, i want to send input 0 or 1 to digital pin 3 is it possibile? Edited January 12, 2015 by Cyber Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key Link to comment Share on other sites More sharing options...
Cyber Posted January 12, 2015 Share Posted January 12, 2015 please help me Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key Link to comment Share on other sites More sharing options...
littlebigman Posted June 7, 2023 Share Posted June 7, 2023 On 9/14/2012 at 9:42 PM, AlainB said: Here is the code that I use to calculate the distance between 2 coordinates and also the bearing. It is quite accurate, within 50 meters on a 5000 or so Km distance, from Montreal to Anchorage. For those who just need to compute the distance between two locations in lat+lon, and in meters instead of km: #include <Math.au3> Func _atan2($y, $x) Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y)))) EndFunc Func _DistanceInMeters($Lat1,$Lon1,$Lat2,$Lon2) Local $Distance ;Calculating the distance Local $R = 6378.1 ;Earth radius in Km (Possibly the value used by Google to calculate distances) Local $dLat = _Radian($lat2-$lat1) Local $dLon = _Radian($lon2-$lon1) Local $lat11 = _Radian($lat1) Local $lat22 = _Radian($lat2) Local $a = sin($dLat/2) * sin($dLat/2) + sin($dLon/2) * sin($dLon/2) * cos($lat11) * cos($lat22) Local $c = 2 * _atan2(sqrt($a), sqrt(1-$a)); $Distance = $R * $c $Distance = Round($Distance,2) * 1000 ;Round to two decimal places, and convert to meters Return $Distance EndFunc $distance =_DistanceInMeters($REF_LAT, $REF_LON, $GpsLatitude_Decimal, $GpsLongitude_Decimal) ConsoleWrite(StringFormat("CurrLat %s CurrLon %s Distance %s" & @CRLF,$GpsLatitude_Decimal, $GpsLongitude_Decimal,$distance)) Link to comment Share on other sites More sharing options...
RTFC Posted June 7, 2023 Share Posted June 7, 2023 (edited) Three observations: you're reviving a long-dead thread. Other than the final conversion from km to meters (actually 10m, given you round to two decimals instead of three, why?), the distance calculation is identical to the earlier-posted one. Suggesting accuracy to the meter (given your function's name) is misleading, not only because of the 10m fudge factor, but more importantly, because the calculation itself is inaccurate, in assuming a spherical Earth (its radius is ca. 21 kilometers less at the poles); GPS instead uses a reference ellipsoid such as WGS-84. If accuracy to the meter is required, you'll need a specific ellipsoid for a given part of the globe (for example, an Airy ellipsoid for mainland Britain); needless to say, such a computation is more involved. Finally, in the context of GPS usage, if you hold several commercial GPS devices next to one another, they often don't agree very well, so deriving a distance in meters from a (commerical-device's) GPS-produced output won't be accurate anyway (military-grade GPS devices are another story though...). Edited June 8, 2023 by RTFC littlebigman 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
littlebigman Posted June 8, 2023 Share Posted June 8, 2023 I don't understand why it's such a problem adding to a thread that dealt with the same problem, or close enough to not justify creating a new one, but I can live with that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now