New heterocyclic TTF compounds 1a-c and 2 with an azobenzene moiety were described. The oxidation potential of 1a could be reversibly modulated by alternating UV and visible light irradiation. As a result, a molecular switch with UV/visible light as the inputs and the electrochemical signal as the output was achieved. Moreover, it was found that the influence of the azobenzene photoisomerization on the electronic property of the TTF unit became stronger with shorter spacers in compounds 1a-c.