BTW this is the datasheet of the sensor
Sensing Distance: 5 mm
Supply Voltage: 24 V
Output Configuration: NPN
Maximum Output Current: 200 mA
Operating Supply Voltage: 12 V to 24 V
Output Voltage: 2 V
I wish someone could help me in installation and coding. Thanks alot. God Bless!