Reply To: PIC16F877A with DC Gear Motor

Update again, sorry. The PIC interfacing with relay and motor has no problem now, sorry about the hassle.

Now is just the interfacing my sensor with PIC, any suggestion how should I connect the proximity sensor to my PIC to allow it to have an output of 1 (into my PIC input 2) when sense something, and have an output of 0 (into my PIC input 2) when it does not sense anything?

The specification of my proximity sensor is as shown in the previous 2 post, in order for my output of my sensor to work, I need to connect the black wire(output) to the load and then to the brown wire(positive) as it is a NPN sensor.