The invention relates to a lighting device (41) for an optoelectronic sensor having at least one lighting path (45a, 45b), wherein the lighting path (45a, 45b) comprises at least one light-emitting unit (46a, 46b) for emitting
transmitted light and a
detector (50a, 50b) for detecting the
transmitted light or a current driving the light-emitting unit, and wherein the lighting device (41) comprises at least one driver (49a, 49b) with a driver output, which is connected to the light-emitting unit (46a, 46b) for control by means of a current
signal, and a modulator (55) connected to a driver input for modulating the current
signal, and with a
delay detection circuit (53) and at least one
delay compensation circuit (47a, 47b), and wherein - The
detector (50a, 50b) is connected to the
delay detection circuit (53) for providing a
detector signal, - The delay detection circuit (53) is designed and arranged to measure a time delay of the detector signal relative to the modulation signal (Mod), - The delay compensation circuit (47a, 47b) is designed and configured to adjust a signal
propagation time of the modulation signal (Mod) as a function of the detected time delay. Furthermore, a method for operating a corresponding lighting device (41) is specified.