Esempio n. 1
0
def print_temperature_ext(conn, settings, uid):
    from tinkerforge.bricklet_ptc import BrickletPTC

    br = BrickletPTC(uid, conn)
    print_generic(
        settings,
        "temperature.ext",
        br.get_identity(),
        0.01,
        "\N{DEGREE SIGN}C",
        br.get_temperature(),
    )
Esempio n. 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_ptc import BrickletPTC

if __name__ == "__main__":
    ipcon = IPConnection() # Create IP connection
    ptc = 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)
    temperature = ptc.get_temperature()
    print("Temperature: " + str(temperature/100.0) + " °C")

    raw_input("Press key to exit\n") # Use input() in Python 3
    ipcon.disconnect()
Esempio n. 3
0
def print_temperature_ext(conn, settings, uid):
    from tinkerforge.bricklet_ptc import BrickletPTC  # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel
    br = BrickletPTC(uid, conn)
    print_generic(settings, "temperature.ext", br.get_identity(), 0.01, u"\N{DEGREE SIGN}C",
                  br.get_temperature())
Esempio n. 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_ptc import BrickletPTC

if __name__ == "__main__":
    ipcon = IPConnection()  # Create IP connection
    ptc = 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)
    temperature = ptc.get_temperature()
    print("Temperature: " + str(temperature / 100.0) + " °C")

    raw_input("Press key to exit\n")  # Use input() in Python 3
    ipcon.disconnect()