If you want you can try the circuit , it does not uses an kind of programming or PLC. Its a very simple proximity sensor circuit with latch
control. It is basic analog electronics however it employs the use of CD4017 decade counter for latching the proximity sense signal.
Proximity Sensor...