Photoelectric sensing with easy setting