Artificial neural networks (ANNs) are inspired by the biological nervous system. The high performance of such ANNs is achieved through the dynamic change of the synaptic weights by applying self-optimizing learning algorithms. Despite the simple operations for each single element in an ANN, a network with a huge number of simulated elements consumes lots of computing capacity using von Neumann computer architectures. To overcome this issue, neuromorphic devices facilitate the design of hardware ANNs that emulate the synaptic functions. Here we demonstrate the viability of such an approach using photonic waveguides in combination with a photochromic diarylethene (DAE) molecule. By positioning and irradiating DAE molecules on single waveguides, we modulate the intensity and thereby emulate the plasticity of the synaptic weights. To run the photonic device as an ANN we firstly characterize the modulation range and encode a learning procedure accordingly. As the proof of concept, we operate a y-shaped waveguide performing basic AND/OR logic gate functions, with the capability to switch between these two gate functions by using specific training sets.