Magnets have north and south poles and like poles repel while unlike poles attract. There are permanent magnets made from iron alloys and electric magnets created by running current through a coil of wire. The magnetic field around a magnet gets weaker with distance from its poles. Electromagnets are useful because their poles can be reversed by switching current direction. Motors use electromagnets and permanent magnets to convert electrical energy to mechanical motion via electromagnetic induction. Generators operate on the same principles but convert mechanical motion to electrical energy. Transformers increase or decrease voltage in power grids to safely deliver electricity to homes.