Jump to content

adrianbernhard

Members
  • Gesamte Inhalte

    27
  • Benutzer seit

  • Letzter Besuch

Posts erstellt von adrianbernhard

  1. Moin Moin,

    heute kam meine neue Bestellung mit dem 20x4 LCD Display. Da habe ich mich gleich ran gesetzt und erstmal die Beispielscripte getestet.

    Bei Python 3.2.3 verweigert das Script seine Tätigkeit, das Display geht an aber den write Befehl führt er nicht aus. Hier das angepasste Script:

     

     

    #!/usr/bin/env python

    # -*- coding: utf-8 -*- 

     

    HOST = "localhost"

    PORT = 4223

    UID = "7Yo" # Change to your UID

     

    from ip_connection import IPConnection

    from bricklet_lcd_20x4 import LCD20x4

     

    if __name__ == "__main__":

        ipcon = IPConnection(HOST, PORT) # Create ip connection to brickd

     

        lcd = LCD20x4(UID) # Create device object

        ipcon.add_device(lcd) # Add device to ip connection

        # Don't use device before it is added to a connection

     

        # Turn backlight on

        lcd.backlight_on()

     

        # Write "Hello World"

        lcd.write_line(0, 0, 'Hello World')

     

        input('Press key to exit\n') # Use input() in Python 3

        ipcon.destroy()

     

    und der Fehler:

     

    Traceback (most recent call last):

      File "C:\Users\Adrian\Desktop\tinker\example_hello_world.py", line 22, in <module>

        lcd.write_line(0, 0, 'Hello World')

      File "C:\Users\Adrian\Desktop\tinker\ip_connection.py", line 67, in func

        return f(self, *args, **kwargs)

      File "C:\Users\Adrian\Desktop\tinker\bricklet_lcd_20x4.py", line 46, in write_line

        self.ipcon.write(self, LCD20x4.TYPE_WRITE_LINE, (line, position, text), 'B B 20s', '')

      File "C:\Users\Adrian\Desktop\tinker\ip_connection.py", line 244, in write

        write_data += struct.pack('<' + f, d)

    struct.error: argument for 's' must be a bytes object

     

    Unter 2.7 tritt der Fehler nicht auf.

    Ich kann leider mit dem Fehler nicht viel anfangen.

     

×
×
  • Neu erstellen...