One of the key challenges in the construction of atomic-scale circuits and molecular machines is to design molecular rotors and switches by controlling the linear or rotational movement of a molecule while preserving its intrinsic electronic properties. Here, we demonstrate both the continuous rotational switching and the controlled step-by-step single switching of a trinaphthylene molecule adsorbed on a dangling bond dimer created on a hydrogen-passivated Ge(001):H surface. The molecular switch is on-surface assembled when the covalent bonds between the molecule and the dangling bond dimer are controllably broken, and the molecule is attached to the dimer by long-range van der Waals interactions. In this configuration, the molecule retains its intrinsic electronic properties, as confirmed by combined scanning tunneling microscopy/spectroscopy (STM/STS) measurements, density functional theory calculations, and advanced STM image calculations. Continuous switching of the molecule is initiated by vibronic excitations when the electrons are tunneling through the lowest unoccupied molecular orbital state of the molecule. The switching path is a combination of a sliding and rotation motion over the dangling bond dimer pivot. By carefully selecting the STM conditions, control over discrete single switching events is also achieved. Combined with the ability to create dangling bond dimers with atomic precision, the controlled rotational molecular switch is expected to be a crucial building block for more complex surface atomic-scale devices.