I've been messing around with Raspberry Pi and RFID and found this tutorial:
https://pimylifeup.com/raspberry-pi-rfid-rc522/
Everything went fine with the installation but when I'm running the script it presents an error.
This is the problem:
pi@raspberrypi:~/MFRC522-python $ sudo python Write.py
/home/pi/MFRC522-python/MFRC522.py:115: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(25, GPIO.OUT)
Traceback (most recent call last):
File "Write.py", line 6, in <module>
reader = SimpleMFRC522.SimpleMFRC522()
File "/home/pi/MFRC522-python/SimpleMFRC522.py", line 14, in __init__
self.READER = MFRC522.MFRC522()
File "/home/pi/MFRC522-python/MFRC522.py", line 117, in __init__
self.MFRC522_Init()
File "/home/pi/MFRC522-python/MFRC522.py", line 390, in MFRC522_Init
self.MFRC522_Reset();
File "/home/pi/MFRC522-python/MFRC522.py", line 120, in MFRC522_Reset
self.Write_MFRC522(self.CommandReg, self.PCD_RESETPHASE)
File "/home/pi/MFRC522-python/MFRC522.py", line 123, in Write_MFRC522
spi.transfer(((addr<<1)&0x7E,val))
TypeError: function takes exactly 2 arguments (1 given)
This is the Write.py file:
#!/usr/bin/env python
import RPi.GPIO as GPIO
import SimpleMFRC522
reader = SimpleMFRC522.SimpleMFRC522()
try:
text = raw_input('New data:')
print("Now place your tag to write")
reader.write(text)
print("Written")
finally:
GPIO.cleanup()
I can't find the solution to this problem in any place. Already tried to use Python 3 and other libraries but I'm still getting the error.
UPDATE :
Edited this on MFRC522.py file :
def Write_MFRC522(self, addr, val):
spi.transfer( (addr<<1)&0x7E, val )
And now I get this output :
/home/pi/MFRC522-python/MFRC522.py:115: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(25, GPIO.OUT)
First argument must be a valid dictionary.: Success
Aborted