l0
.
lineTo
(
w
-
6
, h
-
1
)
l0
.
moveTo
(
w
-
1
,
5
)
l0
.
lineTo
(
w
-
1
,
0
)
l0
.
lineTo
(
w
-
6
,
0
)
REM
draw a circle
in
the top left corner
of
layer
1
l1
=
disp
.
get_displayLayer
(
1
)
l1
.
clear
()
l1
.
drawCircle
(CInt(
h
/
8
)
,
CInt(
h
/
8
)
,
CInt(
h
/
8
))
REM
and
animate the layer
Console
.
WriteLine
(
"Use Ctrl-C to stop"
)
x
=
0
y
=
0
vx
=
1
vy
=
1
While
(
disp
.
isOnline
())
x
+=
vx
y
+=
vy
If
((
x
<
0
)
Or
(
x
>
w
-
(
h
/
4
)))
Then
vx
=
-
vx
If
((
y
<
0
)
Or
(
y
>
h
-
(
h
/
4
)))
Then
vy
=
-
vy
l1
.
setLayerPosition
(
x, y,
0
)
YAPI
.
Sleep
(
5
, errmsg
)
End
While
yFreeAPI
()
End
Sub
End
Module
13.4. 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.
Imports
System
.
IO
Imports
System
.
Environment
Module
Module1
Sub
usage
()
Console
.
WriteLine
(
"usage: demo <serial or logical name> [ON/OFF]"
)
End
End
Sub
Sub
Main
()
Dim
argv
()
As
String
=
System
.
Environment
.
GetCommandLineArgs
()
Dim
errmsg
As
String
=
""
Dim
m
As
ymodule
If
(
yRegisterHub
(
"usb"
, errmsg
)
<>
YAPI_SUCCESS
)
Then
Console
.
WriteLine
(
"RegisterHub error:"
+
errmsg
)
End
End
If
If
argv
.
Length
<
2
Then
usage
()
m
=
yFindModule
(
argv
(
1
))
REM
use serial
or
logical name
If
(
m
.
isOnline
())
Then
If
argv
.
Length
>
2
Then
If
argv
(
2
)
=
"ON"
Then
m
.
set_beacon
(
Y_BEACON_ON
)
If
argv
(
2
)
=
"OFF"
Then
m
.
set_beacon
(
Y_BEACON_OFF
)
End
If
Console
.
WriteLine
(
"serial: "
+
m
.
get_serialNumber
())
Console
.
WriteLine
(
"logical name: "
+
m
.
get_logicalName
())
Console
.
WriteLine
(
"luminosity: "
+
Str
(
m
.
get_luminosity
()))
Console
.
Write
(
"beacon: "
)
If
(
m
.
get_beacon
()
=
Y_BEACON_ON
)
Then
Console
.
WriteLine
(
"ON"
)
Else
Console
.
WriteLine
(
"OFF"
)
End
If
13. Using Yocto-Display with Visual Basic .NET
74
www.yoctopuce.com
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...