Proximity sensor technology, Photosensor in automation