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

hammy:
No I’m suggesting you dump the motor and drive a relay with an Arduino output . Use the relay contacts to switch your load .

You seem to have the wrong end of the stick.

AFAIK the OP wants to use the motor as an INPUT device.

...R