Digital proximity sensor, photoelectric switch