Search code examples
pythonraspberry-pi3rfid

Python on Raspberry Pi 3


I am trying to code a RFID access system that utilizes an actuator to turn on and off. I followed a simple tutorial that can be found here.

I completed the tutorial fully and now have encountered problems:

  1. I noticed when following the tutorial, the "python" we were coding was different from actual Python... for example, we don't do the curly brackets to end anything. Is there a way I can program and have access to my RFID module with the normal "Python" that I learned?
  2. I am having issues finding the syntax's attached to SimpleMFRC522, because from what I read, it is a simplified way to interact with the RFID reader. So shouldn't there be certain syntax/functions attached to it?
  3. When running a simple program that reads a tags ID and TEXT associated with the tag, I come across errors that usually wouldn't be an error on the normal python, for example...

    Python Code

    After running that code (labeled 'Python Code'), I come across...

    Actual Error

I am extremely confused and need guidance or referral to anything I could possibly learn to help me finish this project. All or any help is appreciated and seriously considered.


Solution

  • Similar issue to this post.

    You cannot concatenate a string and an integer so you must pull the id out of the object then typecast it to a string:

    unsure what the 'id' name is within the object but let's assume it's 'id'

    ... (code above)
    
    try:
        print('Place your tag to be read.')
        id_obj, text = reader.read()
        print('Your ID is ' + str(id_obj.id))
        print('Your text is ' + text)
    
    ... (code below)