Electro-optical unit comprising a photodiode, a light-emitting diode each having a first and a second electrode and a programmable resistive memory element having a first and a second terminal, the electro-optical unit further having a first, a second and a third control terminal wherein the photodiode and the programmable resistive memory element are coupled in series between the first control terminal and the third control terminal and wherein the light-emitting diode and the programmable resistive memory element are coupled in series between the second control terminal and the third control terminal, characterized in that the electro-optical unit includes a common node in which one of said first and second electrode of the photodiode, one of said first and second electrode of the light-emitting diode and one of said first and second terminal of the programmable resistive memory element are commonly connected, and in that the programmable resistive memory element is programmable in a conducting state by application of a first voltage between said first and second control terminal of the electro-optical unit and is programmable in a non-conducting state by application of a second voltage between said first and second control terminal of the electro-optical unit.