Skip to content

Instantly share code, notes, and snippets.

@shanselman
Created October 26, 2024 22:40
Show Gist options
  • Save shanselman/284c9f7d522af430c8e1a5141c44f802 to your computer and use it in GitHub Desktop.
Save shanselman/284c9f7d522af430c8e1a5141c44f802 to your computer and use it in GitHub Desktop.
moovtest.py
from py532lib.i2c import *
from py532lib.frame import *
from py532lib.constants import *
from py532lib.mifare import *
import ndef
import logging
last_card_data = None
while True:
pn532 = Pn532_i2c()
pn532.SAMconfigure()
card_data = pn532.read_mifare().get_data()
if (card_data != last_card_data):
print(list(card_data))
last_card_data = card_data
# for record in ndef.message_decoder(card_data): print(record)
pn532.reset_i2c()
'''
print("2")
card = Mifare()
card.SAMconfigure()
card.set_max_retries(MIFARE_SAFE_RETRIES)
uid = card.scan_field()
if uid:
address = card.mifare_address(0,1)
card.mifare_auth_a(address,MIFARE_FACTORY_KEY)
data = card.mifare_read(address)
card.in_deselect() # In case you want to authorize a different sector.
print(data)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment