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

    #endregion Fields

    #region Methods

    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletPTC ptc = new BrickletPTC(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 = ptc.GetTemperature();
        Console.WriteLine("Temperature: " + temperature/100.0 + " °C");

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
Beispiel #2
0
    private static string UID  = "XYZ";    // Change to your UID

    static void Main()
    {
        IPConnection ipcon = new IPConnection();          // Create IP connection
        BrickletPTC  ptc   = new BrickletPTC(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 = ptc.GetTemperature();

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

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

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

        // 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!
        ptc.SetTemperatureCallbackPeriod(1000);

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

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

    #endregion Fields

    #region Methods

    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletPTC ptc = new BrickletPTC(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.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!
        ptc.SetTemperatureCallbackPeriod(1000);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
Beispiel #5
0
    static void Main()
    {
        IPConnection ipcon = new IPConnection();          // Create IP connection
        BrickletPTC  ptc   = new BrickletPTC(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)
        ptc.SetDebouncePeriod(10000);

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

        // Configure threshold for temperature "greater than 30 °C"
        ptc.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 PTC Bricklet

    #endregion Fields

    #region Methods

    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletPTC ptc = new BrickletPTC(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)
        ptc.SetDebouncePeriod(10000);

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

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

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

    // Callback function for temperature callback (parameter has unit °C/100)
    static void TemperatureCB(BrickletPTC sender, int temperature)
    {
        System.Console.WriteLine("Temperature: " + temperature / 100.0 + " °C");
    }
 // Callback function for temperature callback (parameter has unit °C/100)
 static void TemperatureCB(BrickletPTC sender, int temperature)
 {
     Console.WriteLine("Temperature: " + temperature/100.0 + " °C");
 }
Beispiel #9
0
    private static string UID  = "XYZ";    // Change to your UID

    // Callback for temperature greater than 30 °C
    static void ReachedCB(BrickletPTC sender, int temperature)
    {
        System.Console.WriteLine("We have: " + temperature / 100.0 + " °C");
        System.Console.WriteLine("It is too hot, we need air conditioning!");
    }