using rfid with master card to flip a relay

Ok first off I’m kind of new to the Arduino and coding world. I have been working on a set up with the RC522 RFID reader and the code I’m trying to use is a system with a master card (you swipe that card and can add unknown cards or delete known cards) and an RGB LED. When the program starts up on the Arduino after uploading it, you swipe what you want to be the master card then the system goes into ready mode. You can swipe the master card again and the arduino goes into program mode. If you swipe the master card again the Arduino exits program mode and goes into ready mode. This part works just fine. The problem starts when you swipe another card to be programed in as an accepted card. The system freezes up. If the reset button is pressed the Arduino resets and goes into ready mode with the master card remembered. When an unknown card gets swiped in ready mode, the program again freezes up. The end goal here is to flip a relay for a short period of time. I can’t seem to figure out how to get past the program freezing up either trying to program a card or just to get it to decline an unknown card. Any help is greatly appreciated.

rfid_access_control.ino (24.4 KB)


What's the point of printing a blank line?

What DO your serial print's tell you is happening?

The system freezes up.

That seems unlikely. It is more likely that you have an endless loop that you are waiting for to end, that has no Serial.print() statements in it. Exactly where that might be happening is hard to say, with all those useless comments and no serial output to look at.