Exemplo n.º 1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XYZ" # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon) # Create device object

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

    # Get current ambient temperature (unit is °C/10)
    ambient_temperature = tir.get_ambient_temperature()
    print("Ambient Temperature: " + str(ambient_temperature/10.0) + " °C")

    # Get current object temperature (unit is °C/10)
    object_temperature = tir.get_object_temperature()
    print("Object Temperature: " + str(object_temperature/10.0) + " °C")

    raw_input("Press key to exit\n") # Use input() in Python 3
    ipcon.disconnect()
Exemplo n.º 2
0
PORT = 4223
UID = "XYZ"  # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR


# Callback function for object temperature reached callback (parameter has unit °C/10)
def cb_object_temperature_reached(temperature):
    print("Object Temperature: " + str(temperature / 10.0) + " °C")
    print("The water is boiling!")


if __name__ == "__main__":
    ipcon = IPConnection()  # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon)  # Create device object

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

    # Set emissivity to 0.98 (emissivity of water, 65535 * 0.98 = 64224.299)
    tir.set_emissivity(64224)

    # Get threshold callbacks with a debounce time of 10 seconds (10000ms)
    tir.set_debounce_period(10000)

    # Register object temperature reached callback to function cb_object_temperature_reached
    tir.register_callback(tir.CALLBACK_OBJECT_TEMPERATURE_REACHED,
                          cb_object_temperature_reached)

    # Configure threshold for object temperature "greater than 100 °C" (unit is °C/10)
Exemplo n.º 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XYZ"  # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR

if __name__ == "__main__":
    ipcon = IPConnection()  # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon)  # Create device object

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

    # Get current ambient temperature (unit is °C/10)
    ambient_temperature = tir.get_ambient_temperature()
    print("Ambient Temperature: " + str(ambient_temperature / 10.0) + " °C")

    # Get current object temperature (unit is °C/10)
    object_temperature = tir.get_object_temperature()
    print("Object Temperature: " + str(object_temperature / 10.0) + " °C")

    raw_input("Press key to exit\n")  # Use input() in Python 3
    ipcon.disconnect()
Exemplo n.º 4
0
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "XYZ" # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR

# Callback function for object temperature callback (parameter has unit °C/10)
def cb_object_temperature(temperature):
    print("Object Temperature: " + str(temperature/10.0) + " °C")

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon) # Create device object

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

    # Register object temperature callback to function cb_object_temperature
    tir.register_callback(tir.CALLBACK_OBJECT_TEMPERATURE, cb_object_temperature)

    # Set period for object temperature callback to 1s (1000ms)
    # Note: The object temperature callback is only called every second
    #       if the object temperature has changed since the last call!
    tir.set_object_temperature_callback_period(1000)

    raw_input("Press key to exit\n") # Use input() in Python 3
    ipcon.disconnect()
Exemplo n.º 5
0
HOST = "localhost"
PORT = 4223
UID = "XYZ"  # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR


# Callback function for object temperature callback (parameter has unit °C/10)
def cb_object_temperature(temperature):
    print("Object Temperature: " + str(temperature / 10.0) + " °C")


if __name__ == "__main__":
    ipcon = IPConnection()  # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon)  # Create device object

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

    # Register object temperature callback to function cb_object_temperature
    tir.register_callback(tir.CALLBACK_OBJECT_TEMPERATURE,
                          cb_object_temperature)

    # Set period for object temperature callback to 1s (1000ms)
    # Note: The object temperature callback is only called every second
    #       if the object temperature has changed since the last call!
    tir.set_object_temperature_callback_period(1000)

    raw_input("Press key to exit\n")  # Use input() in Python 3
    ipcon.disconnect()
Exemplo n.º 6
0
 def create_instance(self, uid, ipcon):
     return BrickletTemperatureIR(uid, ipcon)
HOST = "localhost"
PORT = 4223
UID = "XYZ" # Change XYZ to the UID of your Temperature IR Bricklet

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_temperature_ir import BrickletTemperatureIR

# Callback function for object temperature reached callback
def cb_object_temperature_reached(temperature):
    print("Object Temperature: " + str(temperature/10.0) + " °C")
    print("The water is boiling!")

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    tir = BrickletTemperatureIR(UID, ipcon) # Create device object

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

    # Set emissivity to 0.98 (emissivity of water, 65535 * 0.98 = 64224.299)
    tir.set_emissivity(64224)

    # Get threshold callbacks with a debounce time of 10 seconds (10000ms)
    tir.set_debounce_period(10000)

    # Register object temperature reached callback to function
    # cb_object_temperature_reached
    tir.register_callback(tir.CALLBACK_OBJECT_TEMPERATURE_REACHED,
                          cb_object_temperature_reached)