I have a relay that has a ground trigger, that is supposed to output 5V to the Arduino when triggered. The issue is that, since the switch is not grounded until it is closed, this means that I have a floating input when it is open. Thus when calling analogRead, I get a high value regardless of whether the relay is open or closed. Suggestions? Would calling pinMode(INPUT_PULLUP) solve the issue, or would I need some additional component? I am using an Arduino Leonardo by the way.
You might want to post a schematic. One side of the relay contact needs to be connected to ground and the INPUT_PULLUP would be on the pin connected to the other side of the contact. When the relay is on you will get a low and when off you will get a high. I hope this answers your question.