Switching Poles Automatically
The rotating electromagnet will have to be connected to the 2 wires through which we pass the current. Since it's rotating on a center shaft, we can't have a solid connection. Instead we have to extend the wires from the coil out along the shaft and let the electric contact be made with brushes which touch the wires along the shaft.
Figure 4. A rotating electromagnet changes poles as contacts are made first one way, then the other.
This is a simple way to reverse the current in the coil of the electromagnet.