Contrôle De La Partie Module - Yoctopuce Yocto-0-10V-Tx Mode D'emploi

Table des Matières

Publicité

System.out.println("demo any
System.out.println("
System.exit(1);
}
public static
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
String
target
double
voltage
if (target.equals("ANY")) {
YVoltageOutput
if
(tmp
System.out.println("No module connected (check USB
System.exit(1);
}
try {
target
} catch
System.out.println("No module connected (check USB
System.exit(1);
}
}
YVoltageOutput
);
YVoltageOutput
);
try {
// output 1 : immediate change
vout1.set_currentVoltage(voltage);
// output 2 : smooth change
vout2.voltageMove(voltage,3000);
} catch
(YAPI_Exception
System.out.println("Module not connected (check identification and USB cable)"
);
}
YAPI.FreeAPI();
}
}
16.3. Contrôle de la partie module
Chaque module peut-être contrôlé d'une manière similaire, vous trouverez ci-dessous un simple
programme d'exemple affichant les principaux paramètres d'un module et permettant d'activer la
balise de localisation.
import com.yoctopuce.YoctoAPI.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class
Demo
public static
{
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
www.yoctopuce.com
<voltage>
<voltage>: floating point number between 0.0 and
void
main(String[] args)
ex) {
< 3) usage();
= args[0].toUpperCase();
= Double.valueOf(args[1]);
tmp
= YVoltageOutput.FirstVoltageOutput();
== null) {
= tmp.module().get_serialNumber();
(YAPI_Exception
ex) {
vout1
=
YVoltageOutput.FindVoltageOutput(target
vout2
=
YVoltageOutput.FindVoltageOutput(target
ex) {
{
void
main(String[] args)
ex) {
16. Utilisation du Yocto-0-10V-Tx en Java
(use any discovered
{
device)");
10.000");
+
running");
cable)");
cable)");
+
".voltageOutput1"
+
".voltageOutput2"
+
running");
105

Publicité

Table des Matières
loading

Table des Matières