Omron Inductive Sensor (E2E-X5ME1)

Good Day Masters, I'm new to Arduino and I have a project that should detect metallic objects. I bought an inductive sensor*(Omron E2E-X5ME1)*, and I would just want to ask for ideas, or sample calculation or sample code to detect if an object is metallic or not. I really need it badly. Thanks a lot in advance!

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!

So this is a 3-wire sensor, ground, supply and an open-collector output (as far as I can see). I suggest powering it at 12V, and running a 1k resistor from its output to 5V rail.

Before connecting to Arduino check that the output switches from about 5V (no metal present) to about 0V (metal present) - any voltage higher than 5V means I'm wrong about its connection - don't connect it to Arduino!