Merge pull request #18 from jerryneedell/jerryn_ntag203

fix readwrite_ntag203.py example
This commit is contained in:
Limor "Ladyada" Fried 2019-02-03 13:23:52 -05:00 committed by GitHub
commit 6e2b2a6688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,7 @@ print('Waiting for RFID/NFC card to write to!')
while True: while True:
# Check if a card is available to read # Check if a card is available to read
uid = pn532.read_passive_target(timeout=0.5) uid = pn532.read_passive_target(timeout=0.5)
print('.', end="", flush=True) print('.', end="")
# Try again if no card is available. # Try again if no card is available.
if uid is not None: if uid is not None:
break break
@ -78,7 +78,7 @@ print('Found card with UID:', [hex(i) for i in uid])
# Set 4 bytes of block to 0xFEEDBEEF # Set 4 bytes of block to 0xFEEDBEEF
data = bytearray(4) data = bytearray(4)
data[0:4] = [0xFE, 0xED, 0xBE, 0xEF] data[0:4] = b'\xFE\xED\xBE\xEF'
# Write 4 byte block. # Write 4 byte block.
pn532.ntag2xx_write_block(6, data) pn532.ntag2xx_write_block(6, data)
# Read block #6 # Read block #6