A line-of-sight optical detection system comprises: a plurality of dimmable light sources (11, 12, 13, 14); a controller (30) for controlling the light sources to emit coded light; a detector (21, 22, 23, 24), receiving light from two or more of said light sources. The controller decodes the detector output signal, determines which light source contributes to the light received by the detector and, on the basis of the outcome, determines a location of an object (2). A communication system (100) comprises:—a plurality of dimmable light sources (111, 112, 113, 114); a controller (130) for controlling the light sources to emit coded light; a receiver (200) comprising a CPU (230) and a light detector (211), receiving light from at least one of said light sources. The CPU (230) decodes the detector output signal and, on the basis of the outcome, decides on an action to be taken.