Jump to content

Python File "example_simple.py", line 21, in <module> value = idi4.get_value


Recommended Posts

Geschrieben

Guten Abend,

 

ich habe probleme python example_enumerate.py fuer "Industrial Digital In 4" an meinem Raspberry Pi(Raspbian) ich habe den daemon und den viewer genau so installiert wie beschrieben und es läuft beides.

auch "alle"nötingen python packete hinzugefügt ( example_enumerate.py läuft ja)

jedoch kann ich nichts auslesen ...

# Read out values as bitmask

    value = idi4.get_value()

___________________________________

example_enumerate.py zeigt alles richtig an

 

 

pi@raspitest2 ~/TF/examples $ python example_enumerate.py

Press key to exit

UID:              6ffjuh

Enumeration Type:  0

Connected UID:    0

Position:          0

Hardware Version:  (2, 0, 0)

Firmware Version:  (2, 2, 1)

Device Identifier: 13

 

UID:              hyp

Enumeration Type:  0

Connected UID:    6ffjuh

Position:          a

Hardware Version:  (1, 0, 0)

Firmware Version:  (2, 0, 1)

Device Identifier: 223

 

UID:              mWp

Enumeration Type:  0

Connected UID:    6ffjuh

Position:          b

Hardware Version:  (1, 0, 0)

Firmware Version:  (2, 0, 0)

Device Identifier: 225

-------------------------------------------------

in "example_simple.py" habe ich die UID

UID = "mWp" # Change to your UID

eingeragen:

-------------------------------------------------

pi@raspitest2 ~/TF $ cat example_simple.py

#!/usr/bin/env python

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

 

HOST = "localhost"

PORT = 4223

UID = "mWp" # Change to your UID

 

import time

 

from tinkerforge.ip_connection import IPConnection

from tinkerforge.bricklet_industrial_digital_in_4 import IndustrialDigitalIn4

 

if __name__ == "__main__":

    ipcon = IPConnection() # Create IP connection

    idi4 = IndustrialDigitalIn4(UID, ipcon) # Create device object

 

    ipcon.connect(HOST, PORT) # Connect to brickd

    # Don't use device before ipcon is connected

 

    # Read out values as bitmask

    value = idi4.get_value()

    print('Value: ' + str(bin(value)))

 

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

    ipcon.disconnect()

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

das ist die fehler meldung ...

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

pi@raspitest2 ~/TF $ python example_simple.py

Traceback (most recent call last):

  File "example_simple.py", line 21, in <module>

    value = idi4.get_value()

  File "/usr/local/lib/python2.7/dist-packages/tinkerforge-2.1.2-py2.7.egg/tinkerforge/bricklet_industrial_digital_in_4.py", line 94, in get_value

    return self.ipcon.send_request(self, BrickletIndustrialDigitalIn4.FUNCTION_GET_VALUE, (), '', 'H')

  File "/usr/local/lib/python2.7/dist-packages/tinkerforge-2.1.2-py2.7.egg/tinkerforge/ip_connection.py", line 963, in send_request

    return self.deserialize_data(response[8:], form_ret)

  File "/usr/local/lib/python2.7/dist-packages/tinkerforge-2.1.2-py2.7.egg/tinkerforge/ip_connection.py", line 838, in deserialize_data

    x = struct.unpack(f, data[:length])

struct.error: unpack requires a string argument of length 2

Exception in thread Disconnect-Prober (most likely raised during interpreter shutdown):

Traceback (most recent call last):

  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner

  File "/usr/lib/python2.7/threading.py", line 505, in run

  File "/usr/local/lib/python2.7/dist-packages/tinkerforge-2.1.2-py2.7.egg/tinkerforge/ip_connection.py", line 816, in disconnect_probe_loop

  File "/usr/lib/python2.7/Queue.py", line 174, in get

<type 'exceptions.TypeError'>: 'NoneType' object is not callable

 

-----------------------------------------

 

was ist die ursche für diese fehlermeldung und wie kann ich diese beheben 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...