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

    #endregion Fields

    #region Methods

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

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

        // Get current temperature (unit is °C/100)
        int temperature = t.GetTemperature();
        Console.WriteLine("Temperature: " + temperature/100.0 + " °C");

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
        /// <summary>
        /// Ruft die aktuelle Wassertemperatur ab
        /// </summary>
        /// <returns>Temperatur in C</returns>
        internal static double GetCurrentTemperature()
        {
            try
            {
                IPConnection         ipcon = new IPConnection();                       // Create IP connection
                BrickletThermocouple t     = new BrickletThermocouple(UID_TCB, ipcon); // Create device object
                ipcon.Connect(HOST, PORT);
                int temperature = t.GetTemperature();

                ipcon.Disconnect();
                return(temperature / 100.0);
            }
            catch (Exception ex)
            {
                throw new Exception("Fehler beim Auslesen der Temperatur", ex);
            }
        }
示例#3
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Thermocouple Bricklet

    static void Main()
    {
        IPConnection         ipcon = new IPConnection();                   // Create IP connection
        BrickletThermocouple t     = new BrickletThermocouple(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 = t.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
        BrickletThermocouple t     = new BrickletThermocouple(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
        t.TemperatureCallback += TemperatureCB;

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

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
    private static string UID = "XYZ"; // Change XYZ to the UID of your Thermocouple Bricklet

    #endregion Fields

    #region Methods

    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletThermocouple t = new BrickletThermocouple(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
        t.Temperature += TemperatureCB;

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

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
示例#6
0
    static void Main()
    {
        IPConnection         ipcon = new IPConnection();                   // Create IP connection
        BrickletThermocouple t     = new BrickletThermocouple(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 10 seconds (10000ms)
        t.SetDebouncePeriod(10000);

        // Register temperature reached callback to function TemperatureReachedCB
        t.TemperatureReachedCallback += TemperatureReachedCB;

        // Configure threshold for temperature "greater than 30 °C"
        t.SetTemperatureCallbackThreshold('>', 30 * 100, 0);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
    private static string UID = "XYZ"; // Change XYZ to the UID of your Thermocouple Bricklet

    #endregion Fields

    #region Methods

    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletThermocouple t = new BrickletThermocouple(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 10 seconds (10000ms)
        t.SetDebouncePeriod(10000);

        // Register temperature reached callback to function TemperatureReachedCB
        t.TemperatureReached += TemperatureReachedCB;

        // Configure threshold for temperature "greater than 30 °C" (unit is °C/100)
        t.SetTemperatureCallbackThreshold('>', 30*100, 0);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
示例#8
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Thermocouple Bricklet

    // Callback function for temperature reached callback
    static void TemperatureReachedCB(BrickletThermocouple sender, int temperature)
    {
        Console.WriteLine("Temperature: " + temperature / 100.0 + " °C");
    }
 // Callback function for temperature callback (parameter has unit °C/100)
 static void TemperatureCB(BrickletThermocouple sender, int temperature)
 {
     Console.WriteLine("Temperature: " + temperature/100.0 + " °C");
 }