A sensor apparatus (5a, 5b) comprising: a light projecting unit having a plurality of light emitting elements; a light receiving unit having a plurality of light receiving elements that correspond to the plurality of light emitting elements, each of the plurality of light receiving elements being configured to receive light emitted by a corresponding light emitting element and generate a light reception signal; a control unit having a first mode in which at least one of a plurality of optical axes formed by the corresponding light emitting elements and light receiving elements is used as a sensing optical axis, and a second mode in which an additional sensing optical axis is set by adding an optical axis other than the sensing optical axis of the first mode to the optical axis used as the sensing optical axis in the first mode, the control unit being configured to determine a non-sensing state and a sensing state based on the light reception signal of each light receiving element serving as a sensing optical axis in the respective modes; and an output unit configured to perform output according to the determination result of the control unit, wherein the control unit switches to the second mode when a change from a non-sensing state, in which the light reception signals of the light receiving elements for all of the sensing optical axes of the first mode are signals corresponding to a light receiving state, to a sensing state, in which a light reception signal of the light receiving element for at least one of the sensing optical axes of the first mode is a signal corresponding to a blocked state, occurs in the first mode, characterized in that the plurality of optical axes are aligned along a movement direction of a sensing target, and the sensing optical axes of the second mode include an optical axis located in a direction opposite to the movement direction with respect to the sensing optical axis of the first mode, or the sensing optical axes of the second mode include an optical axis located in the movement direction with respect to the sensing optical axis of the first mode. a light projecting unit having a plurality of light emitting elements; a light receiving unit having a plurality of light receiving elements that correspond to the plurality of light emitting elements, each of the plurality of light receiving elements being configured to receive light emitted by a corresponding light emitting element and generate a light reception signal; a control unit having a first mode in which at least one of a plurality of optical axes formed by the corresponding light emitting elements and light receiving elements is used as a sensing optical axis, and a second mode in which an additional sensing optical axis is set by adding an optical axis other than the sensing optical axis of the first mode to the optical axis used as the sensing optical axis in the first mode, the control unit being configured to determine a non-sensing state and a sensing state based on the light reception signal of each light receiving element serving as a sensing optical axis in the respective modes; and an output unit configured to perform output according to the determination result of the control unit, wherein the control unit switches to the second mode when a change from a non-sensing state, in which the light reception signals of the light receiving elements for all of the sensing optical axes of the first mode are signals corresponding to a light receiving state, to a sensing state, in which a light reception signal of the light receiving element for at least one of the sensing optical axes of the first mode is a signal corresponding to a blocked state, occurs in the first mode, characterized in that the plurality of optical axes are aligned along a movement direction of a sensing target, and the sensing optical axes of the second mode include an optical axis located in a direction opposite to the movement direction with respect to the sensing optical axis of the first mode, or the sensing optical axes of the second mode include an optical axis located in the movement direction with respect to the sensing optical axis of the first mode.