Powering a DC motor with an external battery I'm working on a project where i need to control a 6 volt motor with an Arduino. The motor that I'm using requires 6 volts so I'm using a 9 volt with a voltage divider to get those 6 volts. My problem is that when I use the external power, the motor keeps spinning and ignores the input from the Arduino. If I use a 5&nbsp;V battery and draw the 5&nbsp;V from the Arduino, it works fine. I made sure that the voltage divider sends out 6 volts and the current code should have the motor not spinning. Here is the circuit: Motor Schematic.

What could I do to make the motor take the input from the Arduino?

Note: The schematic isn't like my actual circuit. In reality I have 6&nbsp;V power supply instead of a 9&nbsp;V and a voltage divider. I also am using a motor that requires 6 volts, while the one in the schematic requires 5&nbsp;V.
Your schematic is bad - the motor is connected betveen base and power, emitor is connected to ground.That keeps the transistor open, and B-E voltage is like 0.7V, rest is for the motor to rotate.
More over the transistor is open, so if you send pulses from pin 3, they are shortcuted to ground thru the transistor, not affecting the motor at all.

Switch the wires to Base and to Colector (lines 48 and 49) and it should work better.

(Still I would not use divider 9->6 volts, losing a lot of power constantly, I would rather change the PWM little down (and have it relatively fast, 1kHz or more) and the motor should be OK, if effective voltage ther would be under 6V - so the PWM under like 66% HIGH. Also shortcutting pin3 to ground with resistor is not optimal, the resistor should be between pin3 and Base.)