Recently, the specific hybridization of DNA molecules has been used to construct self-assembled devices, such as the mechanical device to mimic cellular protein motors in nature. Here, we present a new light-powered DNA mechanical device based on the photoisomerization of azobenzene moieties and toehold-mediated strand displacement. This autonomous and controllable device is capable of moving toward either end of the track, simply by switching the wavelength of light irradiation, either UV (365 nm) or visible (>450 nm). This light-controlled strategy can easily solve one main technical challenge for stepwise walking devices: the selection of routes in multipath systems. The principle employed in this study, photoisomerization-induced toehold length switching, could be further useful in the design of other mechanical devices, with the ultimate goal of rivaling molecular motors for cargo transport and macroscopic movement.