This NPN example does NOT require the use of a voltage divider given we can set a pull-up resistor in the microcontroller. If this internal pull-up resistor is not an option, you can use an external 10k ohm resistor from BLACK to +5V. The digital pin will be brought LOW whenever the sensor detects an object.