I am attempting to write a python script on my Raspberry Pi 4 that turns an LED on with an RFID tag and this LED remains on while the RFID tag is in proximity of the reader. When I hold the card to the reader the LED blinks instead of remaining on constantly. I also have an issue where when I remove the tag from the reader on a "Card Found" step, the loop stops iterating and the "No Card in Range" text stops being outputted.
Please see my code below:
from gpiozero import LED
from time import sleep
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
blueled = LED(4)
while True:
status,TagType = reader.read_no_block()
if (status == None):
print("No Card in Range")
blueled.off()
elif (status != None):
print("Card Found")
id, text = reader.read()
if (id == 965463577380):
blueled.on()
Here is what my code outputs while running:
No Card in Range
No Card in Range
No Card in Range
No Card in Range
Card Found
No Card in Range
Card Found
No Card in Range
Card Found