The flywheel switches the electrical current between the electromagnets on the left and the electromagnets on the left.

Press the “Play” button to play the animation. As the flywheel rotates, the electrical current is switched between the two sets of electromagnets causing the iron rod in the armature of the motor to move back and forth.