![Yoctopuce Yocto-GPS User Manual Download Page 95](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557095.webp)
yRegisterHub
The
yRegisterHub
function initializes the Yoctopuce API and specifies where the modules should
be looked for. When used with the parameter
'usb'
, it will use the modules locally connected to the
computer running the library. If the initialization does not succeed, this function returns a value
different from
YAPI_SUCCESS
and
errmsg
contains the error message.
yFindLatitude
The
yFindLatitude
function allows you to find a latitude sensor from the serial number of the
module on which it resides and from its function name. You can also use logical names, as long as
you have initialized them. Let us imagine a Yocto-GPS module with serial number
YGNSSMK1-123456
which you have named "
MyModule
", and for which you have given the
latitude
function the name "
MyFunction
". The following five calls are strictly equivalent, as long as
"
MyFunction
" is defined only once.
latitude := yFindLatitude
(
"YGNSSMK1-
123456
.
latitude
"
)
;
latitude := yFindLatitude
(
"YGNSSMK1-
123456
.
MyFunction
"
)
;
latitude := yFindLatitude
(
"MyModule.
latitude
"
)
;
latitude := yFindLatitude
(
"MyModule.
MyFunction
"
)
;
latitude := yFindLatitude
(
"MyFunction"
)
;
yFindLatitude
returns an object which you can then use at will to control the latitude sensor.
isOnline
The
isOnline()
method of the object returned by
yFindLatitude
allows you to know if the
corresponding module is present and in working order.
get_latitude
The
get_latitude()
method of the object returned by
yFindGps
provides the latitude currently
measured by the Yocto-GPS. The value returned is a string, the format will vary according to the
Yocto-GPS configuration. To get a floating point value, no matter the configuartion, use the YLatitude
Class.
13.3. Control of the module part
Each module can be controlled in a similar manner, you can find below a simple sample program
displaying the main parameters of the module and enabling you to activate the localization beacon.
program
modulecontrol;
{$APPTYPE CONSOLE}
uses
SysUtils,
yocto_api;
const
serial =
'YGNSSMK1-123456'
;
// use serial number or logical name
procedure
refresh
(
module:Tymodule
)
;
begin
if
(
module.
isOnline
())
then
begin
Writeln
(
''
)
;
Writeln
(
'Serial : '
+ module.
get_serialNumber
())
;
Writeln
(
'Logical name : '
+ module.
get_logicalName
())
;
Writeln
(
'Luminosity : '
+
intToStr
(
module.
get_luminosity
()))
;
Write
(
'Beacon :'
)
;
if
(
module.
get_beacon
()
=Y_BEACON_ON
)
then
Writeln
(
'on'
)
else
Writeln
(
'off'
)
;
Writeln
(
'uptime : '
+
intToStr
(
module.
get_upTime
()
div
1000
)
+
's'
)
;
Writeln
(
'USB current : '
+
intToStr
(
module.
get_usbCurrent
())
+
'mA'
)
;
Writeln
(
'Logs : '
)
;
Writeln
(
module.
get_lastlogs
())
;
Writeln
(
''
)
;
Writeln
(
'r : refresh / b:beacon ON / space : beacon off'
)
;
end
13. Using Yocto-GPS with Delphi
www.yoctopuce.com
89
Summary of Contents for Yocto-GPS
Page 1: ...Yocto GPS User s guide...
Page 2: ......
Page 6: ...22 Characteristics 557 Blueprint 559 Index 561...
Page 10: ...4 www yoctopuce com...
Page 14: ...8 www yoctopuce com...
Page 18: ...12 www yoctopuce com...
Page 22: ...16 www yoctopuce com...
Page 38: ...32 www yoctopuce com...
Page 42: ...36 www yoctopuce com...
Page 54: ...48 www yoctopuce com...
Page 72: ...66 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 122: ...116 www yoctopuce com...
Page 132: ...126 www yoctopuce com...
Page 564: ...22 Characteristics 558 www yoctopuce com...
Page 565: ......
Page 566: ......