You still seem not to get it. A digital pin can only report back one of two states, a high or a low where as you want to report three states.
If you use an analogue input then you can detect more states but you need to know how the output of your sensor is driving the analogue input. When you know this you will know if the biasing of the input with a voltage divider is going to work and what value of resistor to use. You connect them from input to 5V and from the same input to Ground.
Many sensors pull down or up only. For this trick to work you need a sensor that both pulls up and down, and you need an analogue input pin.