An array of surface-immobilized proton-fueled DNA nanomachines is reversibly actuated by cycling of the solution pH between 4.5 and 9, producing a conformational change between a four-stranded and a double-stranded structure, which elongates or shortens the separation distance between the 5' and 3' end of the DNA. By labeling the DNA 3' end with a fluorophore and immobilizing it onto a thin-gold surface through its 5' thiol modification, the nanoscale motion of the DNA produces mechanical work to lift up and bring down the fluorophore from the gold surface by at least 2.5 nm and transduces this motion into an optical "on-and-off" nanoswitch.