A toy building system comprising building elements with coupling means for releasably interconnecting building elements, the toy building system comprising function building elements with such coupling means and each having a function device adapted to perform a controllable function and an energy source for providing energy to the function device for performing the controllable function, each function building element comprising a light sensor for receiving visible light encoding a control signal; and a control circuit connected to the light sensor and to the function device and adapted to decode the received control signal and to control the controllable function responsive to the decoded control signal.