Ejemplo n.º 1
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Industrial PTC Bricklet

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

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

        // Get current temperature
        int temperature = ptc.GetTemperature();

        Console.WriteLine("Temperature: " + temperature / 100.0 + " °C");

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
    static void Main()
    {
        IPConnection          ipcon = new IPConnection();                    // Create IP connection
        BrickletIndustrialPTC ptc   = new BrickletIndustrialPTC(UID, ipcon); // Create device object

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

        // Register temperature callback to function TemperatureCB
        ptc.TemperatureCallback += TemperatureCB;

        // Set period for temperature callback to 1s (1000ms) without a threshold
        ptc.SetTemperatureCallbackConfiguration(1000, false, 'x', 0, 0);

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

    // Callback function for temperature callback
    static void TemperatureCB(BrickletIndustrialPTC sender, int temperature)
    {
        Console.WriteLine("Temperature: " + temperature / 100.0 + " °C");
    }