private static string UID = "XYZ"; // Change XYZ to the UID of your Voltage Bricklet

    #endregion Fields

    #region Methods

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

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

        // Register voltage callback to function VoltageCB
        v.Voltage += VoltageCB;

        // Set period for voltage callback to 1s (1000ms)
        // Note: The voltage callback is only called every second
        //       if the voltage has changed since the last call!
        v.SetVoltageCallbackPeriod(1000);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }