A programmable switch based on a DNA hairpin loop is functionalised with a rigid or flexible porphyrin or FAM and TAMRA FRET pair, which provides insight into the restructuring of the hairpin as well as porphyrin-porphyrin coupling. The switch contains five discrete states which can be accessed independently and followed by real-time spectroscopy, opening the way to a quinary computing code.