Jump to content

[Python] NFC Bricklet


Recommended Posts

Ich möchte mit meinem Programm, dass der pages Inhalt meiner NFC Tags gelesen wird:


# Callback function for state changed callback

def cb_state_changed(state, idle, nr):

    # Cycle through all types

    if idle:

        global tag_type

        tag_type = (tag_type + 1) % 3



    if state == nr.STATE_REQUEST_TAG_ID_READY:

        ret = nr.get_tag_id()

        print('Found tag of type ' +

              str(ret.tag_type) +

              ' with ID [' +

              ' '.join(map(str, map(hex, ret.tid[:ret.tid_length]))) +


        data = nr.get_page()

        print('Read data: [' + ' '.join(map(str, data)) + ']')

        client.publish("sensoren/nfc_tag", str(data))



Wenn ich mehrere tags ausprobiere werden mir auch die verschiedenen Tag IDs angezeigt aber immer nur jeweils die pages Inhalte vom ersten gescannten tag.


Sprich in meiner Variable data = nr.get_page() werden nur einmal die Daten vom ersten Scan angezeigt und die ändern sich aber nicht bei den anderen tags.



Link to comment
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...