The third ranging action is a process similar to the second ranging action in S56 and is configured 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 (t11-t12 in FIG. 9) for discharging a voltage according to the distance to the object, thereafter carry out a second integral operation (t