l0
.
drawText
(
w
/
2
, h
/
2
,
YDisplayLayer
.
ALIGN
.
CENTER
,
"Hello world!"
);
// visualize each corner
l0
.
moveTo
(
0
,
5
);
l0
.
lineTo
(
0
,
0
);
l0
.
lineTo
(
5
,
0
);
l0
.
moveTo
(
0
, h
-
6
);
l0
.
lineTo
(
0
, h
-
1
);
l0
.
lineTo
(
5
, h
-
1
);
l0
.
moveTo
(
w
-
1
, h
-
6
);
l0
.
lineTo
(
w
-
1
, h
-
1
);
l0
.
lineTo
(
w
-
6
, h
-
1
);
l0
.
moveTo
(
w
-
1
,
5
);
l0
.
lineTo
(
w
-
1
,
0
);
l0
.
lineTo
(
w
-
6
,
0
);
// draw a circle in the top left corner of layer 1
l1
=
disp
.
get_displayLayer
(
1
);
l1
.
clear
();
l1
.
drawCircle
(
h
/
8
, h
/
8
, h
/
8
);
// 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
)
||
(
x
>
w
-
(
h
/
4
)))
vx
=
-
vx
;
if
((
y
<
0
)
||
(
y
>
h
-
(
h
/
4
)))
vy
=
-
vy
;
l1
.
setLayerPosition
(
x, y,
0
);
YAPI
.
Sleep
(
5
,
ref
errmsg
);
}
YAPI
.
FreeAPI
();
}
}
}
14.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.
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
ConsoleApplication1
{
class
Program
{
static
void
usage
()
{
string
execname
=
System
.
AppDomain
.
CurrentDomain
.
FriendlyName
;
Console
.
WriteLine
(
"Usage:"
);
Console
.
WriteLine
(
execname
+
" <serial or logical name> [ON/OFF]"
);
System.
Threading
.
Thread
.
Sleep
(
2500
);
Environment
.
Exit
(
0
);
}
static
void
Main
(
string
[]
args
)
{
YModule
m
;
string
errmsg
=
""
;
if
(
YAPI
.
RegisterHub
(
"usb"
,
ref
errmsg
)
!=
YAPI
.
SUCCESS
)
{
Console
.
WriteLine
(
"RegisterHub error: "
+
errmsg
);
Environment
.
Exit
(
0
);
}
14. Using Yocto-Display with C#
82
www.yoctopuce.com
Содержание Yocto-Display
Страница 1: ...Yocto Display User Manual...
Страница 2: ......
Страница 40: ...34 www yoctopuce com...
Страница 52: ...46 www yoctopuce com...
Страница 84: ...78 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...22 High level API Reference 152 www yoctopuce com On failure throws an exception or returns a negative error code...
Страница 422: ...416 www yoctopuce com...
Страница 424: ...24 Characteristics 418 www yoctopuce com...