private static string UID = "XYZ"; // Change XYZ to the UID of your Line Bricklet #endregion Fields #region Methods static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get current reflectivity int reflectivity = l.GetReflectivity(); Console.WriteLine("Reflectivity: " + reflectivity); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Line Bricklet static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get current reflectivity int reflectivity = l.GetReflectivity(); Console.WriteLine("Reflectivity: " + reflectivity); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Register reflectivity callback to function ReflectivityCB l.ReflectivityCallback += ReflectivityCB; // Set period for reflectivity callback to 1s (1000ms) // Note: The reflectivity callback is only called every second // if the reflectivity has changed since the last call! l.SetReflectivityCallbackPeriod(1000); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Line Bricklet #endregion Fields #region Methods static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Register reflectivity callback to function ReflectivityCB l.Reflectivity += ReflectivityCB; // Set period for reflectivity callback to 1s (1000ms) // Note: The reflectivity callback is only called every second // if the reflectivity has changed since the last call! l.SetReflectivityCallbackPeriod(1000); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Line Bricklet #endregion Fields #region Methods static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get threshold callbacks with a debounce time of 1 second (1000ms) l.SetDebouncePeriod(1000); // Register reflectivity reached callback to function ReflectivityReachedCB l.ReflectivityReached += ReflectivityReachedCB; // Configure threshold for reflectivity "greater than 2000" l.SetReflectivityCallbackThreshold('>', 2000, 0); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletLine l = new BrickletLine(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get threshold callbacks with a debounce time of 1 second (1000ms) l.SetDebouncePeriod(1000); // Register reflectivity reached callback to function ReflectivityReachedCB l.ReflectivityReachedCallback += ReflectivityReachedCB; // Configure threshold for reflectivity "greater than 2000" l.SetReflectivityCallbackThreshold('>', 2000, 0); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Line Bricklet // Callback function for reflectivity callback static void ReflectivityCB(BrickletLine sender, int reflectivity) { Console.WriteLine("Reflectivity: " + reflectivity); }
// Callback function for reflectivity reached callback static void ReflectivityReachedCB(BrickletLine sender, int reflectivity) { Console.WriteLine("Reflectivity: " + reflectivity); }