The battery on the left sends a current through the electromagnet in the center. The electromagnet attracts the magnet in the motor on the right.

/>

Turn the crank by moving the mouse across the screen from left to right. As the battery rotates, the electrical current is reversed, reversing the polarity of the electromagnet. The changing polarity of the electromagnetic causes the magnet in the motor to move back and forth.