Yoctopuce Yocto-MaxiDisplay Mode D'emploi page 93

Module électronique
Table des Matières

Publicité

layer0.moveTo(0,
layer0.lineTo(l,
layer0.drawText(mx, my, al,
}
public static
{
YDisplay
disp;
YDisplayLayer
int
h, w, y, x, vx,
// API init
try {
// setup the API to use local VirtualHub
YAPI.RegisterHub("127.0.0.1");
} catch
(YAPI_Exception
System.out.println("Cannot contact VirtualHub on 127.0.0.1 ("
ex.getLocalizedMessage() + ")");
System.out.println("Ensure that the VirtualHub application is
System.exit(1);
}
if
(args.length
disp
= YDisplay.FirstDisplay();
if
(disp
System.out.println("No module connected (check USB
System.exit(1);
}
} else {
disp
= YDisplay.FindDisplay(args[0] + ".display");
}
try {
//clean up
disp.resetAll();
// retreive the display size
w
= disp.get_displayWidth();
h
= disp.get_displayHeight();
// reteive the first layer
l0
= disp.get_displayLayer(0);
// display a text in the middle of the screen
l0.drawText(w
// visualize each corner
l0.moveTo(0,
l0.lineTo(0,
l0.lineTo(5,
l0.moveTo(0, h
l0.lineTo(0, h
l0.lineTo(5, h
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
// draw a circle in the top left corner of layer 1
l1
= disp.get_displayLayer(1);
l1.clear();
l1.drawCircle(h
// and animate the layer
System.out.println("Use Ctrl-C to
x
= 0;
y
= 0;
vx
= 1;
vy
= 1;
while (true) {
x
y
if
}
www.yoctopuce.com
my);
my);
text);
void
main(String[] args)
l0,
l1;
vy;
ex) {
== 0) {
== null) {
/
2, h
/
2, YDisplayLayer.ALIGN.CENTER,
5);
0);
0);
- 6);
- 1);
- 1);
-
1, h
- 6);
-
1, h
- 1);
-
6, h
- 1);
-
1,
5);
-
1,
0);
-
6,
0);
/
8, h
/
8, h
+= vx;
+= vy;
((x
< 0) ||
(x
>
w
-
vx
= -vx;
13. Utilisation du Yocto-MaxiDisplay en Java
/ 8);
stop");
(h
/ 4))) {
+
running");
cable)");
"Hello
world!");
87

Publicité

Table des Matières
loading

Ce manuel est également adapté pour:

Yocto-displayYocto-color-v2

Table des Matières