Jump to content

DrJoe

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. it works: (15348569994255425064L, 13114784581154432808L) Sensor1: 20.69 °C Sensor1: 20.69 °C Sensor2: -0.25 °C Sensor2: -0.25 °C Vielen Dank
  2. Hallo, bitte um mithilfe wenn der ds18b20 sensor mit dem Python script Temperaturen unter null °C ausliest, ergeben sich fehlerhafte werte: Sensor2: 4094.81 °C ? Herausgefunden habe ich das durch einfaches tauschen der Position der sensoren von innen/aussen. hat jemand eine Idee? hier der Code: #!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "localhost" PORT = 4223 UID = "GGW" # Change XYZ to the UID of your One Wire Bricklet import time from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_one_wire import BrickletOneWire if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ow = BrickletOneWire(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected ids = ow.search_bus().identifier print ids #id 13114784581154432808L ow.write_command(13114784581154432808L, 78) # WRITE SCRATCHPAD ow.write(0) # ALARM H (unused) ow.write(0) # ALARM L (unused) ow.write(127) # CONFIGURATION: 12 bit mode # Read temperature 2 times for i in range(2): ow.write_command(13114784581154432808L, 68) # CONVERT T (start temperature conversion) time.sleep(2) # Wait for conversion to finish ow.write_command(13114784581154432808L, 190) # READ SCRATCHPAD t_low = ow.read().data t_high = ow.read().data temperature1 = ('{:6.2f}'.format((t_low | (t_high << ) / 16.0)) print "Sensor1: %s °C" % temperature1 ipcon.disconnect() if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ow = BrickletOneWire(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected ow.write_command(15348569994255425064L, 78) ow.write(0) # ALARM H (unused) ow.write(0) # ALARM L (unused) ow.write(127) # CONFIGURATION: 12 bit mode # Read temperature 2 times for i in range(2): ow.write_command(15348569994255425064L, 68) time.sleep(2) # Wait for conversion to finish ow.write_command(15348569994255425064L, 190) t_low = ow.read().data t_high = ow.read().data temperature2 = ('{:6.2f}'.format((t_low | (t_high << ) / 16.0)) print "Sensor2: %s °C" % temperature2 ipcon.disconnect() Ausgabe: (15348569994255425064L, 13114784581154432808L) Sensor1: 20.25 °C Sensor1: 20.31 °C Sensor2: 4095.69 °C Sensor2: 4095.69 °C ?
  3. das mit den ids hat funktioniert, und wie soll der print befehl für den folgenden sensor geschrieben werden? Verstehe nicht, was in der {0} zu stehen hat inder zeile print. #!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "localhost" PORT = 4223 UID = "GGW" # Change XYZ to the UID of your One Wire Bricklet GGW import time from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_one_wire import BrickletOneWire if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ow = BrickletOneWire(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected ids = ow.search_bus().identifier print ids ow.write_command(15348569994255425064L, 78) # WRITE SCRATCHPAD ow.write_command(14772109243647972136L, 78) ow.write(0) # ALARM H (unused) ow.write(0) # ALARM L (unused) ow.write(127) # CONFIGURATION: 12 bit mode # Read temperature 2 times for i in range(2): ow.write_command(15348569994255425064L, 68) ow.write_command(14772109243647972136L, 68) time.sleep(1) # Wait for conversion to finish ow.write_command(15348569994255425064L, 190) # READ SCRATCHPAD ow.write_command(14772109243647972136L, 190) t_low = ow.read().data t_high = ow.read().data print('Temperature: {0} °C'.format((t_low | (t_high << ) / 16.0)) print('Temperature1: {0} °C'.format((t_low | (t_high << ) / 16.0)) #raw_input("Press key to exit\n") # Use input() in Python 3 ipcon.disconnect() als Ergebnis bekomme ich: (15348569994255425064L, 14772109243647972136L) Temperature: 17.3125 °C Temperature1: 17.3125 °C Temperature: 17.3125 °C Temperature1: 17.3125 °C Vielen Dank
  4. Hallo, wie muss denn der python code aussehen, wenn mehrere ds18b20 Sensoren mit dem 1wire bricklet ausgelesen werden sollen? Ich bin leider etwas ratlos #!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "localhost" PORT = 4223 UID = "GGW" # Change XYZ to the UID of your One Wire Bricklet GGW import time from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_one_wire import BrickletOneWire if __name__ == "__main__": ipcon = IPConnection() # Create IP connection ow = BrickletOneWire(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected ow.write_command(0, 78) # WRITE SCRATCHPAD ow.write(0) # ALARM H (unused) ow.write(0) # ALARM L (unused) ow.write(127) # CONFIGURATION: 12 bit mode # Read temperature 10 times for i in range(5): ow.write_command(0, 68) # CONVERT T (start temperature conversion) time.sleep(1) # Wait for conversion to finish ow.write_command(0, 190) # READ SCRATCHPAD t_low = ow.read().data t_high = ow.read().data print('Temperature: {0} °C'.format((t_low | (t_high << ) / 16.0)) print('Temperature1: {0} °C'.format((t_low | (t_high << ) / 16.0))#?? raw_input("Press key to exit\n") # Use input() in Python 3 ipcon.disconnect() Vielen Dank für die Hilfe
  5. Hello, i have a problem with the new LCD 128x64 Bricklet in python 2.7.3 running on a raspberry. When i run this code: #!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "localhost" PORT = 4223 UID = "XYZ" # Change XYZ to the UID of your LCD 128x64 Bricklet from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_lcd_128x64 import BrickletLCD128x64 if __name__ == "__main__": ipcon = IPConnection() # Create IP connection lcd = BrickletLCD128x64(UID, ipcon) # Create device object ipcon.connect(HOST, PORT) # Connect to brickd # Don't use device before ipcon is connected # Clear display lcd.clear_display() # Write "Hello World" starting from upper left corner of the screen lcd.write_line(0, 0, "Hello World") raw_input("Press key to exit\n") # Use input() in Python 3 ipcon.disconnect() this error is shown: Traceback (most recent call last): File "display.py", line 13, in <module> from tinkerforge.bricklet_lcd_128x64 import BrickletLCD128x64 ImportError: No module named bricklet_lcd_128x64[/color] Can anyone help me?
  6. Hallo, kann mir jemand einen einfachen Python Code für das outdoor weather bricklet nennen? also grade nicht das callback-beispiel. kann nichts finden also in etwa so: https://www.tinkerforge.com/de/doc/Software/Bricklets/PTCV2_Bricklet_Python.html#ptc-v2-bricklet-python-examples
×
×
  • Create New...