changing a polarity or a +/- of a dc motor?

is there any easy and simple way to change a polarity/ side/ direction or a +/- of a dc motor.

DPDT relay?

Maybe an H-bridge?

Hi Muneeb

Simplest solution DPDT switch (double pole double throw)

If you used center off, then you would also get an off position. The motor gets wired to the center position.

E.g. Easiest Way To Reverse Electric Motor Directions - Robot Room

Regards Bill

there are no programming code to change a polarity?

Yes, of course, unless you're using physical switches

Any video or tutorial for this,

is it also possible to change a +/- of a dc motor using a potentionmeter or a photo resistor with a code

Tell us what hardware you've got and what sort of a motor you're trying to control.

(and please, don't just say "it's a 12V motor")

i have an arduino uno,
and im trying to controlle a +/- of dc motor that is 3 to 9 volts

There are some motor controller shields for the arduino. Easiest way. Plenty of code examples.

so tell me the code :smiley:

Here is my blog with a higher current motor shield. I thought I had some example code on there, let me find it.

This is just a rudimentary example to control the motor shield.

im trying to controlle a +/- of dc motor that is 3 to 9 volts

I suppose I asked for that. :roll_eyes:

When asked to describe a motor, you need to state the voltage and the current.

Think about it; a slot-car runs on 12V, but so does a starter motor.