17. Utilisation du Yocto-Thermocouple en VisualBasic .NET
If Not (tsensor.isOnline()) Then
Console.WriteLine("Module not connected (check identification and USB
End
End If
Console.Write("channel 1: "
Console.Write("channel 2: "
Console.WriteLine("
YAPI.Sleep(1000,
End While
YAPI.FreeAPI()
End Sub
End Module
17.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.
Imports
System.IO
Imports
System.Environment
Module
Module1
Sub usage()
Console.WriteLine("usage: demo <serial or logical name>
End
End Sub
Sub Main()
Dim argv() As
Dim
errmsg
As
Dim
m
As
ymodule
If
(YAPI.RegisterHub("usb",
Console.WriteLine("RegisterHub error:"
End
End If
If
argv.Length
m
= YModule.FindModule(argv(1)) REM
If (m.isOnline()) Then
If
argv.Length
If argv(2) =
If argv(2) =
End If
Console.WriteLine("serial:
Console.WriteLine("logical name: "
Console.WriteLine("luminosity:
Console.Write("beacon:
If (m.get_beacon() = Y_BEACON_ON) Then
Console.WriteLine("ON")
Else
Console.WriteLine("OFF")
End If
Console.WriteLine("upTime:
Console.WriteLine("USB current:
Console.WriteLine("Logs:")
Console.WriteLine(m.get_lastLogs())
Else
Console.WriteLine(argv(1) +
End If
YAPI.FreeAPI()
End Sub
End Module
128
+ Str(ch1.get_currentValue()) +
+ Str(ch2.get_currentValue()) +
(press Ctrl-C to
errmsg)
String
= System.Environment.GetCommandLineArgs()
String
=
""
errmsg) <> YAPI_SUCCESS) Then
<
2
Then usage()
>
2
Then
"ON"
Then m.set_beacon(Y_BEACON_ON)
"OFF"
Then m.set_beacon(Y_BEACON_OFF)
")
" not connected (check identification and USB
exit)")
+ errmsg)
use serial
or
logical name
"
+ m.get_serialNumber())
+ m.get_logicalName())
"
+ Str(m.get_luminosity()))
"
+ Str(m.get_upTime() / 1000) +
"
+ Str(m.get_usbCurrent()) +
cable)")
" °C
")
" °C
")
[ON/OFF]")
"
sec")
"
mA")
cable)")
www.yoctopuce.com