How to make a DC motor act as some sort of switch