![Yoctopuce Yocto-GPS User Manual Download Page 83](http://html1.mh-extra.com/html/yoctopuce/yocto-gps/yocto-gps_user-manual_3415557083.webp)
Dim
argv
()
As
String
=
System
.
Environment
.
GetCommandLineArgs
()
Dim
errmsg
As
String
=
""
Dim
newname
As
String
Dim
m
As
YModule
If
(
argv.
Length
<>
3
)
Then
usage
()
REM Setup the API to use local USB devices
If
yRegisterHub
(
"usb"
, errmsg
)
<> YAPI_SUCCESS
Then
Console
.
WriteLine
(
"RegisterHub error: "
+ errmsg
)
End
End
If
m = yFindModule
(
argv
(
1
))
REM use serial or logical name
If
m.
isOnline
()
Then
newname = argv
(
2
)
If
(Not
yCheckLogicalName
(
newname
))
Then
Console
.
WriteLine
(
"Invalid name ("
+ n
")"
)
End
End
If
m.
set_logicalName
(
newname
)
m.
saveToFlash
()
REM do not forget this
Console
.
Write(
"Module: serial= "
+ m.
get_serialNumber
)
Console
.
Write(
" / name= "
+ m.
get_logicalName
())
Else
Console
.
Write(
"not connected (check identification and USB cable"
)
End
If
yFreeAPI
()
End
Sub
End
Module
Warning: the number of write cycles of the nonvolatile memory of the module is limited. When this
limit is reached, nothing guaranties that the saving process is performed correctly. This limit, linked to
the technology employed by the module micro-processor, is located at about 100000 cycles. In short,
you can use the
saveToFlash()
function only 100000 times in the life of the module. Make sure
you do not call this function within a loop.
Listing the modules
Obtaining the list of the connected modules is performed with the
yFirstModule()
function which
returns the first module found. Then, you only need to call the
nextModule()
function of this
object to find the following modules, and this as long as the returned value is not
Nothing
. Below a
short example listing the connected modules.
Module
Module1
Sub
Main
()
Dim
M
As
ymodule
Dim
errmsg
As
String
=
""
REM Setup the API to use local USB devices
If
yRegisterHub
(
"usb"
, errmsg
)
<> YAPI_SUCCESS
Then
Console
.
WriteLine
(
"RegisterHub error: "
+ errmsg
)
End
End
If
Console
.
WriteLine
(
"Device list"
)
M = yFirstModule
()
While
M
IsNot
Nothing
Console
.
WriteLine
(
M.
get_serialNumber
()
+
" ("
+ M.
get_productName
()
+
")"
)
M = M.
nextModule
()
End
While
yFreeAPI
()
End
Sub
End
Module
11. Using Yocto-GPS with Visual Basic .NET
www.yoctopuce.com
77
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: ......