The second ranging action is a process similar to S26 to activate the IRED 4 to emit the predetermined number of pulses, receive the reflected light from the object by the PSD 5, carry out a first integral operation (t7-t8 in FIG. 9) for discharging a voltage according to the distance to the object, thereafter carry out a second integral operation (t8-t9 in FIG. 9), and calculate a second distance