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

Table des Matières

Publicité

12. Utilisation du Yocto-0-10V-Tx en C#
if
(target
== "ANY") {
vout1
= YVoltageOutput.FirstVoltageOutput();
if
(vout1
Console.WriteLine("No module connected (check USB cable)
Environment.Exit(0);
}
target
= vout1.get_module().get_serialNumber();
}
vout1
=
YVoltageOutput.FindVoltageOutput(target
vout2
=
YVoltageOutput.FindVoltageOutput(target
if (vout1.isOnline()) {
// output 1 : immediate change
vout1.set_currentVoltage(voltage);
// output 2 : smooth change
vout2.voltageMove(voltage,
} else {
Console.WriteLine("Module not
Console.WriteLine("check identification and USB
}
YAPI.FreeAPI();
}
}
}
12.4. 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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
ConsoleApplication1
{
class
Program
{
static
void
usage()
{
string
execname
Console.WriteLine("Usage:");
Console.WriteLine(execname
System.Threading.Thread.Sleep(2500);
Environment.Exit(0);
}
static
void
Main(string[] args)
{
YModule
m;
string
errmsg
if
(YAPI.RegisterHub("usb",
Console.WriteLine("RegisterHub error: "
Environment.Exit(0);
}
if
(args.Length
m
= YModule.FindModule(args[0]);
if (m.isOnline()) {
if
(args.Length
if (args[1].ToUpper() == "ON") {
m.set_beacon(YModule.BEACON_ON);
}
if (args[1].ToUpper() == "OFF") {
m.set_beacon(YModule.BEACON_OFF);
76
== null) {
3000);
connected");
= System.AppDomain.CurrentDomain.FriendlyName;
+
" <serial or logical name>
= "";
ref errmsg) !=
< 1)
usage();
>= 2) {
+ ".voltageOutput1");
+ ".voltageOutput2");
cable");
YAPI.SUCCESS) {
+ errmsg);
// use serial or logical name
");
[ON/OFF]");
www.yoctopuce.com

Publicité

Table des Matières
loading

Table des Matières