Need help in getting a motor to run.

Hi all. I'm Berto, and I'm pretty new to all of this. (watch out, an electronics-noob).

I have a simple DC motor I got from an old CD-ROM. when connecting it to the power (5V pin, or 3V3 pin) and to the ground, it runs well. However, I want to control it, so instead if feeding it through a power pin, I was thinking of feeding it through a digital pin, so I wrote this:

void setup(){ pinMode(4,OUTPUT); digitalWrite(4,HIGH); }

void loop(){ }

The 'DigitalWrite' page in tells me I should get the same 5V though pin 4 as I do from the power, but still the motor isn't doing a thing.

Where am I wrong?


p.s. I guess using the digital pin to control a transistor should work, but I haven't worked with transistors yet, and I just want this running. p.s.s. I know that there are 'shields' for this sort of things, but I rather get things done 'the hard way' with the least amount of components.

you shouldnt be running a dc motor directly from any pins at all, even the 5v (its weird that you got it to turn, I didn't think you had the current to do so)... you need to set up a small auxilary system, known as an hbridge... everything you need to know is found here:

Thanks, I'll follow that!