control Constant Current-Electromagnet

I would have to see your code to make any suggestion. However a analogWrite(pin,0) gives full off and analogWrite(pi,255) give full on so I can't see why you don't see a change in field strength if your using full range control.

Lefty