I would probably also add a timer so if the pin is on for a certain interval like 2 seconds it turns back off