Exemplo n.º 1
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Industrial Dual 0-20mA Bricklet 2.0

    static void Main()
    {
        IPConnection ipcon = new IPConnection();           // Create IP connection
        BrickletIndustrialDual020mAV2 id020 =
            new BrickletIndustrialDual020mAV2(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT);                         // Connect to brickd
        // Don't use device before ipcon is connected

        // Get current current from channel 0
        int current = id020.GetCurrent(0);

        Console.WriteLine("Current (Channel 0): " + current / 1000000.0 + " mA");

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
Exemplo n.º 2
0
    static void Main()
    {
        IPConnection ipcon = new IPConnection();           // Create IP connection
        BrickletIndustrialDual020mAV2 id020 =
            new BrickletIndustrialDual020mAV2(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT);                         // Connect to brickd
        // Don't use device before ipcon is connected

        // Register current callback to function CurrentCB
        id020.CurrentCallback += CurrentCB;

        // Set period for current (channel 0) callback to 1s (1000ms) without a threshold
        id020.SetCurrentCallbackConfiguration(0, 1000, false, 'x', 0, 0);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
Exemplo n.º 3
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Industrial Dual 0-20mA Bricklet 2.0

    // Callback function for current callback
    static void CurrentCB(BrickletIndustrialDual020mAV2 sender, byte channel, int current)
    {
        Console.WriteLine("Channel: " + channel);
        Console.WriteLine("Current: " + current / 1000000.0 + " mA");
        Console.WriteLine("");
    }