private static string UID = "xyz"; // Change XYZ to the UID of your Industrial Dual Relay Bricklet static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletIndustrialDualRelay idr = new BrickletIndustrialDualRelay(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected idr.SetValue(true, false); System.Threading.Thread.Sleep(1000); idr.SetValue(false, true); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Industrial Dual Relay Bricklet static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletIndustrialDualRelay idr = new BrickletIndustrialDualRelay(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Turn relays alternating on/off 10 times with 1 second delay for (int i = 0; i < 5; i++) { Thread.Sleep(1000); idr.SetValue(true, false); Thread.Sleep(1000); idr.SetValue(false, true); } Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }