VisionBox .NET Library
CamTrig_Example.vb

Visual Basic example for using the CameraTrigger device

1 
2 Public Class CamTrig_Example
3  Public Shared Sub CameraTrigger()
4  Console.Clear()
5  'acquire a new factory
6  Dim pVIBSystem As VIB_NET.VIBSystem = New VIB_NET.VIBSystem()
7 
8  If pVIBSystem IsNot Nothing Then
9  Try
10  ' Open camera trigger device 0
11  Dim pCameraTrigger As VIB_NET.CameraTrigger = DirectCast(pVIBSystem.OpenDevice(VIB_NET.eDEVICE_TYPE.CAMERA_TRIGGER, 0), VIB_NET.CameraTrigger)
12 
13  If (pCameraTrigger IsNot Nothing) Then
14  Try
15  ' Show number of outputs of the camera trigger device
16  Console.WriteLine(vbNewLine + "Camera Trigger:" + vbNewLine + vbTab + "Number Of Outputs: " + pCameraTrigger.NumberOfOutputs.ToString())
17 
18  ' Switch on all camera outputs
19  pCameraTrigger.SetAll(VIB_NET.CameraTrigger.eTRG_SOURCE.ON, False, True, False, False)
20  System.Threading.Thread.Sleep(1000)
21 
22  ' Switch off all camera outputs
23  pCameraTrigger.SetAll(VIB_NET.CameraTrigger.eTRG_SOURCE.OFF, False, True, False, False)
24 
25  ' Switch on camera channel 0
26  pCameraTrigger.Set(0, VIB_NET.CameraTrigger.eTRG_SOURCE.ON, False, True, False, False)
27  System.Threading.Thread.Sleep(1000)
28 
29  ' Switch off camera channel 0
30  pCameraTrigger.Set(0, VIB_NET.CameraTrigger.eTRG_SOURCE.OFF, False, True, False, False)
31  Catch e As System.Exception
32  Console.WriteLine(e.Message)
33  Finally
34  ' Close camera trigger device
35  pVIBSystem.CloseDevice(pCameraTrigger)
36  pCameraTrigger = Nothing
37  End Try
38  End If
39  Catch e As System.Exception
40  Console.WriteLine(e.Message)
41  Finally
42  'release factory
43  pVIBSystem = Nothing
44  End Try
45 
46 
47  End If
48  Console.WriteLine(vbNewLine + "Press enter to proceed...")
49  System.Console.ReadLine()
50  End Sub
51 End Class