VisionBox .NET Library
Strobe_Example.cs

C# example for using the Strobe device

1 
2 using System;
3 using VIB_NET;
4 
5 namespace CSharp
6 {
7  class Strobe_Example
8  {
9  public static void Strobe()
10  {
11  Console.Clear();
12 
13  try
14  {
15  // Create device objects with the 'using' statement so they get closed automatically:
16  using (VIB_NET.Strobe strobe = new VIB_NET.Strobe())
17  using (VIB_NET.Multiplexer multiplexer = new VIB_NET.Multiplexer())
18  {
19  // Open the first available Strobe device
20  strobe.Open(0);
21 
22  // Open the Multiplexer device
23  multiplexer.Open();
24 
25  // Initialisation of the strobe unit
26  strobe.Init(true);
27  Console.WriteLine("\nStrobe initialised");
28 
29  // Set strobe limits
30  Console.WriteLine("\nMin Off Time: " + strobe.SetLimits(0, 24, 0, 1000, 0, 1000).ToString());
31 
32  // Get strobe values
33  Console.WriteLine("\nMax Current: " + strobe.MaxCurrent.ToString());
34  Console.WriteLine("\nMax On Time: " + strobe.MaxOnTime.ToString());
35  Console.WriteLine("\nMin Off Time: " + strobe.MinOffTime.ToString());
36 
37  // Get current
38  Console.WriteLine("\nCurrent: " + strobe.Current.ToString());
39 
40  // Get ON time
41  Console.WriteLine("\nOn Time: " + strobe.OnTime.ToString());
42 
43  // Get trigger delay
44  Console.WriteLine("\nTrigger Delay: " + strobe.TriggerDelay.ToString());
45 
46  // Get trigger mode
47  Console.WriteLine("\nTrigger Mode: " + strobe.TriggerMode.ToString());
48 
49  // Get trigger source
50  Console.WriteLine("\nTrigger Source: " + strobe.TriggerSource.ToString());
51 
52  // Get trigger source invert
53  Console.WriteLine("\nTrigger Source Invert: " + strobe.TriggerSourceInvert.ToString());
54 
55  // Get trigger voltage
56  Console.WriteLine("\nTrigger Voltage: " + strobe.Voltage.ToString());
57 
58  // Deactivate validation for current
59  strobe.Validate = false;
60 
61  // Set current
62  strobe.Current = 500;
63 
64  // Activate validation for current
65  strobe.Validate = true;
66 
67  // Set current
68  strobe.Current = 500;
69 
70  // Set ON time
71  strobe.OnTime = 100;
72 
73  // Set trigger delay
74  strobe.TriggerDelay = 10;
75 
76  // Set trigger mode
77  // Pay attention to set the trigger mode to HARDWARE before you set the trigger source and the trigger source invert
78  strobe.TriggerMode = VIB_NET.Strobe.eSTROBE_MODE.HARDWARE_EDGE;
79 
80  // Get new trigger mode
81  Console.WriteLine("\nNew Trigger Mode: " + strobe.TriggerMode.ToString());
82 
83  // Connect the trigger signal from digital input 0 throuhg the Multiplexer
84  strobe.TriggerSource = VIB_NET.Strobe.eSTROBE_SOURCE.MUX_OUT0;
85  multiplexer.ConnectOutput(0, VIB_NET.Multiplexer.eMUX_SOURCE.DIG_IN0);
86 
87  // Set trigger source invert
88  strobe.TriggerSourceInvert = false;
89 
90  // Get new values:
91  Console.WriteLine("\n\nNew Values: ");
92  Console.WriteLine("\nCurrent: " + strobe.Current.ToString());
93  Console.WriteLine("\nOn Time: " + strobe.OnTime.ToString());
94  Console.WriteLine("\nTrigger Delay: " + strobe.TriggerDelay.ToString());
95  Console.WriteLine("\nTrigger Mode: " + strobe.TriggerMode.ToString());
96  Console.WriteLine("\nTrigger Source: " + strobe.TriggerSource.ToString());
97  Console.WriteLine("\nTrigger Source Invert: " + strobe.TriggerSourceInvert.ToString());
98  Console.WriteLine("\nTrigger Voltage: " + strobe.Voltage.ToString());
99 
100  // Trigger the strobe by Software
101  strobe.TriggerMode = VIB_NET.Strobe.eSTROBE_MODE.SOFTWARE_EDGE;
102  Console.WriteLine("\nNew Trigger Mode: " + strobe.TriggerMode.ToString());
103  strobe.SwTrigger = true;
104  Console.WriteLine("\nSoftware Trigger");
105  strobe.SwTrigger = false;
106  strobe.TriggerMode = VIB_NET.Strobe.eSTROBE_MODE.HARDWARE_EDGE;
107  Console.WriteLine("\nNew Trigger Mode: " + strobe.TriggerMode.ToString());
108  strobe.TriggerSource = VIB_NET.Strobe.eSTROBE_SOURCE.MUX_OUT0;
109  strobe.TriggerSourceInvert = false;
110 
111  } // Close all devices
112  }
113  catch (System.Exception e)
114  {
115  Console.WriteLine(e.Message);
116  }
117 
118  Console.WriteLine("\nPress enter to proceed...");
119  System.Console.ReadLine();
120  }
121  }
122 }
123 
VIB_NET
All relevant classes and functions are residing in this namespace.
Definition: CameraLinkIn.cpp:6
VIB_NET::Multiplexer
This class controls the Multiplexer unit which connects signal sources and sinks with each other.
Definition: VIB_NET.h:978
VIB_NET::Strobe::eSTROBE_SOURCE
eSTROBE_SOURCE
Trigger source definitions for the strobe unit, used with TriggerSource
Definition: VIB_NET.h:677
VIB_NET::Multiplexer::eMUX_SOURCE
eMUX_SOURCE
Source signal definitions for the Multiplexer
Definition: VIB_NET.h:983
VIB_NET::Strobe
This class represents the LED Strobe Controller.
Definition: VIB_NET.h:658
VIB_NET::Strobe::eSTROBE_MODE
eSTROBE_MODE
Mode definitions for the strobe unit, used with TriggerMode
Definition: VIB_NET.h:662