Yes. You will need to "tie" the input pin to the opposite signal to that which the relay switches it to. If you connect the relay between 5V and the pin, you will need to "tie" the pin to 0V through a resistor, so that when the relay isn't being powered the pin is held at 0V by the resistor. When the relay turns on, the resistance between the pin and 5V is much less than the resistance between the pin and ground, and 5V is read by the pin.