the thing that should be focused on is keycard into the unlock the door system to control solenoid operation for letting lock the door to open/close automatically from getting sunlight. Meanwhile, when LDR is getting light, motor should rotate forward while it would rotate reverse when LDR is not getting light.