How the Steam Engine Works
Most steam locomotives use a piston steam engine for propulsion. A crank on the drive wheel converts the piston’s back-and-forth motion into a circular motion.
A control mechanism is required to ensure that steam is applied alternately to the front and rear of the piston, and to vent the exhaust steam. The internal control can be achieved using a slide valve or a piston. Visible to the observer is the external control mechanism: at first glance, a jumble of rods and levers.

How the external control system works. The animation shows the control system as developed by Walschaert (Belgium, 1844) and Heusinger (Germany, 1849)
Forward and Reverse Motion

The swing rod (1) and the slide push rod (3) move in opposite directions

The swing rod (1) and the slide push rod (3) move in unison
Other control types:
- Stephenson
- Gooch
- Allan
- Gölsdorf
- Baker