check the power source

Definitely a resistor and not a diode - a reverse biased diode will allow the pin to 'float'. And make sure the internal pull-up is disabled on the pin in question.