Rfid servo lock

Hi. Can anyone help me please.

I want to make a rfid servo lock.

I want it to work as follows

Scan a stored rfid tag an then the servo turns one way and stays there.

Scan the same stored rfid tag again and servo turns the other way and stays there.

The code that comes with the examples in the software turns one way for a specific time and then returns to original position without scanning the same tag again.

Attached is the example code

Please help

servo_motor.ino (19.3 KB)

Please help

With what? If you don't want the servo moving back after the delay, don't make it do that.

If you want granted() to move the servo to one position sometimes and to another position other times, it is up to you to change the logic of granted() and to somehow determine which position the servo should move to. A global or static boolean to keep track of whether the servo is in the "open" position, or not, seems logical.