A sensor device according to the present invention has a detection mode for detecting an object W, a first setting mode for changing the output duration of an output signal, and a second setting mode for changing a light-emission period of light emitted to the object W. These modes are switchable by a mode selector switch 12. If a rotary control knob 15 is operated in the detection mode, a CPU 30 changes a setting of a threshold value in response to the operation of the rotary control knob 15 and displays the changed setting of the threshold value on a digital indicator 20. This makes it possible to accurately change settings through relatively simple operations. The rate of change may correspond to the speed of operation of the knob.