How to use a sensor in order to detect if a mechanical component has moved?
I would keep it simple and use a microswitch to detect the end position:



and connect it to your Vcc. Add a pull-down resistor to ground, and you get a logic level indicating the status: high = switch closed, low = switch open.