Generators are the opposite of electric motors, which convert electrical energy into mechanical energy.